Created
December 6, 2018 13:10
-
-
Save ThomasG77/9233aa603c419d0450f99dcc1cd6f7c0 to your computer and use it in GitHub Desktop.
Démo pour montrer comment reprojeter en EPSG 2154 un CSV issu du géocodage de l'API CSV de http://adresse.data.gouv.fr/
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
## How to reproject to EPSG 2154 | |
# Get data | |
cd /tmp/ | |
wget http://www.douane.gouv.fr/Portals/0/fichiers/datadouane/geolocalisation/annuaire-des-debits-de-tabac-2018.zip | |
# Uncompress | |
unp annuaire-des-debits-de-tabac-2018.zip | |
# Take only 10 first lines | |
head annuaire-des-debits-de-tabac-2018.csv > head-annuaire-des-debits-de-tabac-2018.csv | |
# Call API Adresse CSV endpoint | |
curl -X POST -F data=@head-annuaire-des-debits-de-tabac-2018.csv -F columns=ADRESSE -F postcode="CODE POSTAL" -F columns=COMMUNE https://api-adresse.data.gouv.fr/search/csv/ > head-annuaire-des-debits-de-tabac-2018.geocoded.csv | |
# Convert reprojecting from EPSG 4326 to 2154 (transformation add X, Y columns containing reprojected coordinates) | |
ogr2ogr -f CSV -t_srs EPSG:2154 -s_srs EPSG:4326 output.csv head-annuaire-des-debits-de-tabac-2018.geocoded.csv -lco GEOMETRY=AS_XY -oo X_POSSIBLE_NAMES=lon* -oo Y_POSSIBLE_NAMES=lat* -oo KEEP_GEOM_COLUMNS=YES |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment