geojson-vt on leaflet

update Sept 2015: nice explanation of how geojson-vt works here

Mapbox technologies used in their webgl and opengl libraries are being extracted into standalone pieces. Vladimir Agafonkin,creator of leaflet.js, earcut.js provided slicing and polygon simplification library for geojson called Goejson-vt.Geojson-vt can slice geosjon into tiles aka mapbox tiles.
Quick test and sample of using geojson-vt on leaflet with canvas drawing available here:

2 videos:

Overview of various geojson samples


folowing video shows 280 MB large geojson !


for comparison here is WebGL version on the same data. This version is loading all data into GPU and leaves everything on WebGL (no optimization). It also takes slightly more time to tessellate all polygons, but once done all seems to run fine. Code used is available here

This entry was posted in Canvas, JavaScript, Leaflet and tagged , , , , . Bookmark the permalink.

9 Responses to geojson-vt on leaflet

  1. Matt says:

    Is this possible using Openlayers API?

    • Stanislav says:

      of course, geojson-vt is not tight to any specific map rendering. I have used leaflet as example.
      I have tried to run geojson-vt also on iOS (using JavaScript core) and MapKit , it worked too. There is geojson-vt port to C++ and Swift too on github.

      • Matt says:

        Thanks for a quick response. I am developing a web application using GeoDjango and Openlayers 2.1.13 API, with tons of data (rows) in my database the panning and browsing of layers on the map is “laggy”. The output is GeoJSON. I want this to integrate in Openlayers but as a beginner, I am confused where to start. I also tried dragging my GeoJSON output in your demo but it doesn’t show. I guess it is about its projection problem. It would be great if you will do this using Openlayers!

  2. Conor says:

    Hi, this looks great. Is it possible to click the tiles and return attribute data to an info window? (I’m using leaflet at the moment).

  3. Thanks so much for your example of mapping with geojson tiles and leaflet. There are other examples out there. I am using the code you posted for several maps including an awesome parcel map with 22k features. Any chance you have looked into updating this method to work with the new grid layer in leaflet beta?

  4. Maciej Wójcik says:

    How to change it to works with leaflet 1.0?

  5. Awais says:

    Is this work to show points vertics tile using leaflet?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s