Turf JS

JavaScript Geospatial Analysis for the Browser, Desktop and Server

 It’s basically what sold me on doing geospatial analysis in node.js. I love it ~ @aboutaaron tw 

Why Turf


/*------------------------------
Turf Speaks GeoJSON 
GeoJSON is the Language of Web GIS
One Tool for Many Platforms
Free & Open Source Software
-------------------------------*/

GeoJSON

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Point", /* LineString, Polygon */
        "coordinates": [102.0, 0.5]
      },
      "properties": {
        "field": "value"
      }
    }
  ]
}

booleanContains()

/*
Zoning  = Zoning Polygon
Address = Address Point
*/

Zoning.features.map(function(feature) {
  if(turf.booleanContains(feature, Address)) {
    console.log('Zoning Code: ', feature.code)
  }else{
    console.log('No Zoning Code Found!');
  }
})

Buffer

Within

Measure

Zoning Finder

Command Line

Turf JS

By Malcolm Meyer