Skip to content

Instantly share code, notes, and snippets.

@antoinecourtin
Last active February 12, 2019 19:54
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 antoinecourtin/7695769e4bd38a1dd8fab4f7716fcea4 to your computer and use it in GitHub Desktop.
Save antoinecourtin/7695769e4bd38a1dd8fab4f7716fcea4 to your computer and use it in GitHub Desktop.

Correction pour l'export geosjon pour un fichier CSV dans OpenRefine et afficher le résultat sur une carte

Pour voir la vidéo du tuto : https://drive.google.com/file/d/1kvsur7ls3ay1RxqOekPTqMIZaKWbjKgF/view

Les données du CSV

Nom_wikidata, Lieu_naissance, Sexe, lon, lat
Lewis Greenleaf Adams, Dallas, masculin, -96.79698789999999, 32.7766642
William A. Boring, New York, masculin, -74.0059728, 40.7127753
Notabene : Pour valider/tester vos fichiers geojson -> http://geojsonlint.com/

Etape n°1 : Aller dans le bouton "Exporter" en haut à droite et choisir dans le menu déroulant "Modélisation". Une fenêtre s'ouvre, indiquez les éléments ci-dessous :

  • A mettre dans Préfixe
{ "type": "FeatureCollection",
    "features": [
  • A mettre dans Modèle de ligne
{ "type": "Feature",
        "geometry": {
          "type": "Point",
          "coordinates": [{{cells["lon"].value}},
                {{cells["lat"].value}}]
          },
          "properties": {
            "Nom": "{{cells["Nom_wikidata"].value}}", 
            "Ville": "{{cells["Lieu_naissance"].value}}",
            "Sexe": "{{cells["Sexe"].value}}"

          }
        }
  • A mettre dans Séparateur de ligne
, 
  • A mettre dans Suffixe
 ]
     }

Etape n°2 : cliquez sur exportez, vous obtenez un fichier .txt

  • Et le résultat :
{ "type": "FeatureCollection",
    "features": [
{ "type": "Feature",
        "geometry": {
          "type": "Point",
          "coordinates": [-96.79698789999999,
                32.7766642]
          },
          "properties": {
            "Nom": "Lewis Greenleaf Adams", 
            "Ville": "Etats-Unis, Dallas",
            "Sexe": "masculin"

          }
        },

{ "type": "Feature",
        "geometry": {
          "type": "Point",
          "coordinates": [-74.0059728,
                40.7127753]
          },
          "properties": {
            "Nom": "William A. Boring", 
            "Ville": "Etats-Unis, New York",
            "Sexe": "masculin"

          }
        } ]
     }

Etape n°3 : modifier l'extension .txt en .geojson

Etape n°4 : allez sur umap (https://umap.openstreetmap.fr) et importer votre fichier

** Et Magie ! **

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