Skip to content

Instantly share code, notes, and snippets.

@ThomasG77
Created December 6, 2018 13:10
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 ThomasG77/9233aa603c419d0450f99dcc1cd6f7c0 to your computer and use it in GitHub Desktop.
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/
## 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