Created
September 30, 2024 13:06
-
-
Save ThomasG77/134cebf5f93a99404849d9820dcc1b18 to your computer and use it in GitHub Desktop.
Recette génération fantoir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git clone [email protected]:BaseAdresseNationale/fantoir.git | |
cd fantoir | |
yarn | |
# Data generated using https://github.com/landryb/topo2fantoir to convert Topo to fantoir | |
# Manual download of https://drive.opendata.craig.fr/s/opendata?path=%2Fadresse%2Ffantoir | |
# then concatenate after decompressing all gz files to fantoir.txt | |
cat fantoir.txt | yarn build | |
# Remarque ci-dessous obsolète: il reste des fichiers fantoir pour 2023 mais pas pour 2024 avec disparition fantoir au profit de Topo | |
wget -O fantoir-2023.sqlite https://adresse.data.gouv.fr/data/db/fantoir/2023/fantoir.sqlite | |
sqlite3 fantoir-2023.sqlite 'SELECT key FROM keyv' >| /tmp/keyv-2023.txt | |
sqlite3 fantoir.sqlite 'SELECT key FROM keyv' >| /tmp/keyv-2024.txt | |
wc -l /tmp/keyv-2023.txt /tmp/keyv-2024.txt | |
# 36836 /tmp/keyv-2023.txt | |
# 34879 /tmp/keyv-2024.txt | |
# 71715 total | |
export FANTOIR_PATH=$(pwd)/fantoir.sqlite | |
echo "const {createFantoirCommune} = require('./lib') | |
async function main() { | |
const fantoirCommune = await createFantoirCommune('54099') | |
console.log(fantoirCommune.findVoie('rue du parc')) | |
console.log(fantoirCommune.findVoie('rue du parc', '54342')) | |
} | |
main().catch(error => { | |
console.error(error) | |
process.exit(1) | |
}) | |
" >| demo.js | |
node demo.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment