Sunday, December 28, 2014

GIS for Digital Maps

Turf is a JavaScript library which allows digital maps to implement many common GIS functions. Using Turf digital maps can perform geospatial processing tasks with GeoJSON data. Turf connects to Leaflet, and is also now available as a Mapbox.js plugin.

You can get a great overview of the range of Turf's geospatial processing capabilities on the Turf examples page. Using the library with Leaflet and Mapbox is very easy. It took me less than 15 minutes to set-up this map of central London police stations. I grabbed the GeoJSON data for the stations using Overpass Turbo and then simply used the html for the turf-nearest example in the Turf documentation.

The map shows the nearest London police station to a certain point. The queried location is pre-determined in this map but it should be a simple task to make the marker of the queried location draggable. Turf can process the geospatial query in the browser so it should be simple to allow users to query the map to find the nearest police station to any location.

No comments: