I had some endpoints of a lines that I needed to convert to GeoJSON today.  Before I started I do what every GIS professional does, take inventory of the multitude of ways to actually accomplish this.  I mentally jotted down the following:

  • Esri ArcGIS
  • QGIS
  • Online tools (csv -> json)
  • R
  • Python

I started to realize that these are all pretty heavy tools to just accomplish something as simple as a line string to line.  We literally pull out a chainsaw when all we want it to trim a little piece of paper.  Nothing simple about converting some coordinates into JSON.  Enter Turf.js.

turf.linestring - Creates a LineString based on a coordinate array. Properties can be added optionally.

turfjs

So simple, plus it’s JavaScript already.  Honestly I need to keep coming back to Turf.js, the docs cover easily 90% of what we mostly do with GIS every day.  I just run Turf.js on my laptop and now I don’t even have to open up QGIS to get my work done.  The best part, all JavaScript!  So who is writing the Turf.js book right now?