acefael

.. on software

Follow me on GitHub

GeoJSON

15 Apr 2016

I created a GeoJSON extraction interface for Smallworld. Its core is the method .as_geojson(_optional out_stream) on the main geometry type mixins.

The GeoJSON Specification is available on geojson.org. It is a 10-minute read and it is easy to implement.

My product is on my github page. Loading the geojson module adds functionality to the relevant exemplars. Example usage is.

sw_module_manager.load_module(:geojson)
$
gis_program_manager.cached_dataset(:gis).collections[:min_road].as_geojson()
$

This prints all roads with fields of the default visibility tag as a feature collection. geojson.io is a cool page to verify and view your GeoJSON data. It can also give a good impression of the load on a browser, when many Geometries are rendered.

GeoJSON is a very simple data format and it has the reach of Javascript. It can be used out of the box with leaflet and mapbox. On the other hand, keep in mind that you probably lost some detail of your RWO, once it is serialised as standard GeoJSON.