Skip to content

Instantly share code, notes, and snippets.

@ThomasG77
Last active November 10, 2022 19:33
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ThomasG77/c8b3e33ae90180e985646e1ef4876dfe to your computer and use it in GitHub Desktop.

5 minutes pour passer du JSON vers du GeoJSON avec jq

Récupérez les données (URL fixe prise sur https://www.data.gouv.fr/fr/datasets/lieux-de-mediation-numerique-organisation-cartographie-nationale-des-lieux-de-mediation-numerique-2/)

curl -s https://static.data.gouv.fr/resources/lieux-de-mediation-numerique-organisation-cartographie-nationale-des-lieux-de-mediation-numerique-2/20221110-164433/20221110-hinaura-lieux-de-mediation-numeriques-auvergne-rhone-alpes.json

Prenez le JSON qui dispose déjà de coordonnées longitude, latitude et vous avez votre GeoJSON

jq '{"type": "FeatureCollection", "features": [.[] | {"type": "Feature", "properties": {"id": .id, "nom": .nom, "services": .services, "pivot": .pivot, "commune": .commune, "code_postal": .code_postal, "adresse": .adresse, "courriel": .courriel, "publics_accueillis": .publics_accueillis, "conditions_access": .conditions_access, "modalites_accompagnement": .modalites_accompagnement, "horaires": .horaires, "source": .source, "date_maj": .date_maj}, "geometry": {"coordinates": [.longitude, .latitude], "type": "Point"}}]}' 20221110-hinaura-lieux-de-mediation-numeriques-auvergne-rhone-alpes.json >| 20221110-hinaura-lieux-de-mediation-numeriques-auvergne-rhone-alpes.geojson

Aperçu

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View raw

(Sorry about that, but we can’t show files that are this big right now.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment