6

Background

In a leaflet application I am currently using geojson-vt to turn small geoJSON files (45MB) into tiles stored as a javascript variable. This cannot be done with the larger files (900MB) due to memory restrictions. I want to take the large files and turn them into tiles saved on my local machine. This way I can grab the nessessary tiles instead of the whole file.

Research

I believe something similar to gdal2tiles but for vector data is what I need.

TileStashe may yield a solution, but its primary use does not seem to be for my purposes. If this does turn out to be the solution, example useage would help.

How I plan to load the tiles - https://stackoverflow.com/questions/29732790/how-to-serve-map-tiles-from-a-database-using-leafletjs

1 Answer 1

2

GDAL can create vector tiles with the MVT driver https://gdal.org/drivers/vector/mvt.html

For converting GeoJSON data into vector tiles which are saved into MBTiles database file use a command like

ogr2ogr -f MVT -dsco FORMAT=MBTILES -dsco MAXZOOM=10 target.mbtiles source.geojson

Another option is to use Tippecanoe the https://github.com/mapbox/tippecanoe. GeoJSON is the only supported format as input but that is just what you have. For other formats you can convert source data first into GeoJSON with ogr2ogr. The Tippecanoe manual has examples about that as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.