-
Notifications
You must be signed in to change notification settings - Fork 0
How Can I Create Custom Tiles?
Will Granger edited this page Sep 24, 2020
·
8 revisions
Creating custom .mbtiles for a mapping library like Leaflet to consume may seem daunting, but there are many tools available to make the process easy and painless.
The steps below outline how to create custom vector tiles for a particular use case: taking lat/lng coordinates that correspond to polygons, converting that to a custom map layer of shapes, merging that with an existing base map, and creating a new .mbtiles layer.
- (If converting data into vector shapes) Parse lat/lng data into GeoJSON using a script
- Convert GeoJSON from previous step into MbTiles with Tippecanoe
Command will probably look something liketippecanoe -o Kelp.mbtiles Kelp.json
. Keep in mind, the name of the JSON file will determine the layer name of the coordinates from the first step - Download base map tiles from OpenMapTiles
- As of this writing, base map layers are free to download for open-source projects, and are otherwise available for purchase
- Filter out unnecessary laters (optional)
- You can use tile-join to remove unwanted layers from a tileset. Ex: Use tileserver-gl to examine your downloaded tiles (
tileserver-gl downloaded.mbtiles
). Looking at the "data" option, you may notice many unnecessary layers in that tile set. Let's say you only want to retain the "water" layer. You can do this with thetile-join -l water -o filtered.mbtiles downloaded.mbtiles
command, which will create a new tile set with only the "water" layer.
- You can use tile-join to remove unwanted layers from a tileset. Ex: Use tileserver-gl to examine your downloaded tiles (
- Use Tippecanoe’s tile-join to merge tiles created in step 2 above with base map tiles downloaded in step 3
- TODO: the
tile-join
command causes the vector layer created from GeoJSON to only be visible at certain zoom levels. Still trying to figure out what is causing this.
- TODO: the
- Test out your .mbtiles using tileserver-gl
- I recommend using the command-line tool to test everything looks as expected.
- You can also use this tool to make sure your .mbtiles appear as expected for any other steps in this process
-
Custom Vector Tiles from GeoJSON
- More info about creating custom vector and raster tiles available at the link above
-
Mapbox studio (login required)
- Great resource with some tools that allow editing map styles. Might not be helpful for this project, but a good resource nonetheless