Skip to main content
2 of 2
edited tags
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

Converting Mapbox Vector Tiles To GeoJSON

I'm working on a project that needs to do some simple turf.js work on the client. I am using Mapbox to host my GeoJSON data. Mapbox serves the client this data as a vector tile set, which saves a lot on bandwidth and load times on the client for large datasets. Unfortunately turf.js only works with GeoJSON, not Mapbox Vector Tiles. As far as I know, there are two libraries that can convert vector tiles into GeoJSON: vt-geojson, and vector-tile-js. The problem with these libraries is that they are Node.js libraries, not browser javascript.

At this point it seems I have four options:

  • Convert one of these libraries to normal javascript (and spend time doing it)
  • Add Browserify to my project to convert it for me (and messy up my project)
  • Find some other javascript library that can do it for me (and maybe not find one)
  • Write my own library (and spend lots of time and effort)

I'm hoping that someone on here can help me with the third option, finding a JS library.

LavaHot
  • 223
  • 1
  • 3
  • 6