Skip to content

Instantly share code, notes, and snippets.

@GabrielDelepine
Last active October 4, 2023 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GabrielDelepine/024e20a99a6e1e78fe34f4052988857c to your computer and use it in GitHub Desktop.
Save GabrielDelepine/024e20a99a6e1e78fe34f4052988857c to your computer and use it in GitHub Desktop.
Typescript types for BANO
// BANO https://www.data.gouv.fr/fr/datasets/base-d-adresses-nationale-ouverte-bano/
// Tested on the 5.086.571 objects available mid-September 2023
type BanoCity = {
adm_weight: number
city: string
departement: string
id: string
importance: number
lat: number
lon: number
name: string
population: number
postcode: string
region: string
type: "city" | "town" | "village"
}
// BanoLocation target type:street AND type:place (recommended)
type BanoLocation = {
city: string
citycode: string
departement: string
id: string
importance: number
lat: string
lon: string
name: string
postcode: string | string[]
region: string
} & (
| {
type: "place"
housenumbers?: undefined
}
| {
type: "street"
housenumbers?: Record<string, { lat: number; lon: number }>
}
)
// BanoPlace target ONLY type:place
type BanoPlace = {
city: string
citycode: string
departement: string
id: string
importance: number
lat: string
lon: string
name: string
postcode: string | string[]
region: string
type: "place"
}
// BanoStreet target ONLY type:street
type BanoStreet = {
city: string
citycode: string
departement: string
housenumbers?: Record<string, { lat: number; lon: number }>
id: string
importance: number
lat: string
lon: string
name: string
postcode: string | string[]
region: string
type: "street"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment