Can you preform spatial analysis with Javascript?ðŠī
Spatial analysis conjures up thoughts of a desktop application, but what if the same analysis could be done with a javascript library?
A brief introduction
To solve for an in browser spatial analysis solution we can start with tools like Mapbox and GeoJson, but to continue the analysis, that's where Turf.js comes in.
Per the Turf.js website, this library is:
Advanced geospatial analysis for browsers and Node.js
The website goes on to list three main parts that make Turf.js:
Simple
Modular, simple-to-understand JavaScript functions that speak GeoJSON
Modular
Turf is a collection of small modules, you only need to take what you want to use
Fast
Takes advantage of the newest algorithms and doesn't require you to send data to a server
Implement with Web Applications ð
In keeping with the flexibility of modern web applications, Turf.js provides for a light install. The ability to install this packge with npm can help applications (specifically those building applications with React.js) remain agile.
Resources for Getting Started
The Turf.js documentation is a great place to get started. If GitHub is more to your liking, you can find some great use case and examples on the Turf.js repo.
To start building your application, Mapbox has a really great tutorial that I've been using as I build a lost pet locator app on Youtube.
Future Use Cases
In the past, if you wanted to preform geospatial analysis it required a desktop application, or using an online portal such as ArcGIS online. With tools like Turf.js you can build web applications that can do basic spatial analysis in browser. Geoprocessing is still a big hurdle, but with tools like Turf.js in coordination with other services, quality spatial analysis can be done in browser.