collapse

* Forum Staff

PeterC admin PeterC
Administrator
admin webmasterOPS
Administrator

Author Topic: GeoJSON - how we use it  (Read 559 times)

PeterC

  • Administrator
  • Member
  • *****
  • Posts: 460
  • Passionate about my one-place study
    • View Profile
    • Holywell-cum-Needingworth History
GeoJSON - how we use it
« on: 31 July 2016, 07:29:54 »
GeoJSON is a format based on JSON for encoding a variety of geographic data structures - Point, LineString, Polygon, MultiPoint, MultiLineString, and MultiPolygon. Geometric objects with additional properties are Feature objects. Sets of features are contained by FeatureCollection objects. See the spec http://geojson.org/geojson-spec.html .

This Wikipedia article describes GeoJSON, and this article is a very useful summary. A position is an array of coordinates in order: [longitude, latitude, elevation] (Note that many applications use the order latitude, longitude order - so beware!). GeoJSON can have four or more coordinates with undefined meaning, like time. Default projection is EPSG:4326.

geojson.io is an easy way of editing, viewing and updating GEOJSON files - a useful site. It uses mapbox markers (via token).

We use GeoJSON files to provide Feature Layers to M4OPS. These can come from many different places:
  • GIS systems like QGIS
  • public sources
  • saved by M4OPS itself (see the heading New Feature Layers)
  • hand-crafted in a text editor
We can also create GeoJSON files (just for points -  not lines or polygons) from CSV files (eg generated from our Access database for the HcN OPS). To do this:
  • the CSV file must be .csv, and have fields starting lon and lat
  • must use ; (semi-colon) for the separator (rather than comma) and must not use it in any text fields
  • can use empty fields but these are converted to “” (null becomes “null”, so do not use)
  • ? not use field names containing the letters "html"?
  • if generating from Access specify nothing round the text (not even ") and tick the option for field names in first row
  • drag and drop the CSV file onto geojson.io and then save as GeoJSON
See also the list of GeoJSON utilities that will make your life easier.

VBA to JSON is possible (http://ramblings.mcpher.com/Home/excelquirks/json) but we have not used it.

For Edinburgh's Ainslie 1804, each Feature in a FeatureCollection has
  • "type": "Feature"
  • "properties":
    • "ID":
    • "PROPERTY":
  • "geometry":
    • "type": "MultiPolygon", "coordinates": etc
For HcN Pubs, we created the GeoJSON file by exporting a csv file of query MapFile01 and then dropping it onto geojson.io
For HcN Census Entries we do similar.
« Last Edit: 31 July 2016, 07:57:07 by PeterC »

 

mapping4ops.org is a Society for One-Place Studies project supported by Grassroots Giving from Skipton Building Society
Glossary | BBCodes | Feedback