Skip to content

Instantly share code, notes, and snippets.

@psychemedia
Last active August 29, 2015 14:01
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 psychemedia/ddb4b862fc65be2aeb3b to your computer and use it in GitHub Desktop.
Save psychemedia/ddb4b862fc65be2aeb3b to your computer and use it in GitHub Desktop.
Demo tableCols2geojson formatter

Demo TableExportTemplate to generate a geojson file containing a list of points.

Requires:

  • the name of the column containing the marker description (Place in the example);
  • a column containing numerical latitude co-ordinate values (Lat in the example);
  • a column containing numerical longitude co-ordinate values (Long in the example).

Example data:

Place,Lon,Lat
"London, UK",-0.1276597, 51.5072759
"Cambridge, UK",  0.124862, 52.2033051
"Paris, France", 2.3521334, 48.8565056

See an example IPython notebook demonstrating how to apply this template here: http://nbviewer.ipython.org/gist/psychemedia/3ee6f5d1d0a337941ee3

{"Lat":"the name of the latitude column",
"Lon":"the name of the longitude column",
"Place": "the name of the location"
}
{"features": [
{"geometry":
{ "coordinates": [ {{Lon}},
{{Lat}}
],
"type": "Point"},
"id": "{{Place}}",
"properties": {}, "type": "Feature"
}
], "type": "FeatureCollection"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment