Skip to content

Commit

Permalink
Merge pull request #420 from BaseAdresseNationale/antoineludeau/fix-u…
Browse files Browse the repository at this point in the history
…nknown-bounding-box

fix unknown bounding box
  • Loading branch information
nkokla authored May 22, 2024
2 parents 06fb9c8 + 56e8eaf commit 90a7a0e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion geo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/api/consumers/format-to-legacy-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const formatDistrictDataForLegacy = async (district, totalCommonToponymRe

// Geographic data
const districtGeoData = districtsGeographicOutline[cog]
const districtBbox = districtGeoData.bbox
const districtBbox = districtGeoData?.bbox

let addressAnalysis
// Address analysis
Expand Down
7 changes: 6 additions & 1 deletion lib/compose/index.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable complexity */
const {chain, omit, pick, keyBy} = require('lodash')
const bluebird = require('bluebird')

Expand Down Expand Up @@ -127,14 +128,18 @@ async function composeCommune(codeCommune, ignoreIdConfig) {
districtID = digestIDsFromBalAddress(balData.adresses[0], balAddressVersion)?.districtID
}

if (!geo[codeCommune]) {
console.warn(`La commune ${codeCommune} n'a pas de données géographiques associées dans le fichier geo.json`)
}

const communeRecord = {
banId: districtID,
nomCommune: communeCOG.nom,
population: communeCOG.population,
departement: pick(getDepartement(communeCOG.departement), 'nom', 'code'),
region: pick(getRegion(communeCOG.region), 'nom', 'code'),
codesPostaux: communeCOG.codesPostaux || [],
displayBBox: geo[codeCommune].bbox,
displayBBox: geo[codeCommune]?.bbox,
typeCommune: communeCOG.type,
nbNumeros,
nbNumerosCertifies,
Expand Down
2 changes: 1 addition & 1 deletion lib/util/contours.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function db() {
}

async function getCommunesFeatures() {
const response = await fetch('https://adresse.data.gouv.fr/data/contours-administratifs/2023/geojson/communes-50m.geojson')
const response = await fetch('https://adresse.data.gouv.fr/data/contours-administratifs/2024/geojson/communes-50m.geojson')
const communesFile = await response.json()

return communesFile.features
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-geo.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const getStream = require('get-stream')
const {outputJson} = require('fs-extra')
const fetch = require('../lib/util/fetch.cjs')

const communes = 'http://etalab-datasets.geo.data.gouv.fr/contours-administratifs/2023/geojson/communes-100m.geojson.gz'
const communes = 'http://etalab-datasets.geo.data.gouv.fr/contours-administratifs/2024/geojson/communes-100m.geojson.gz'

async function getFeatures(url) {
const response = await fetch(url)
Expand Down

0 comments on commit 90a7a0e

Please sign in to comment.