-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- remove old TM2 articles - update all categories (generate, host, style, website, raster) - switch categories - use Generate own map as `Docs` root - a reference to a `mobile-app` page - update text - format Markdown --------- Co-authored-by: Jiří Komárek <[email protected]>
- Loading branch information
Showing
23 changed files
with
384 additions
and
391 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,47 @@ | ||
--- | ||
layout: docs | ||
category: generate | ||
order: 1 | ||
title: Custom vector tiles from GeoJSON or ShapeFile | ||
description: Custom Vector Tiles from GeoJSON or ShapeFile using open-source tools | ||
order: 2 | ||
title: Custom vector tiles from GeoJSON or Shapefile | ||
description: Custom Vector Tiles from GeoJSON or Shapefile using open-source tools | ||
redirect_from: /docs/generate/custom-vector/ | ||
--- | ||
|
||
You can combine OpenMapTiles with your custom vector data saved in **ShapeFile** or **GeoJSON** format (there is the separate article for [data stored in **PostGIS** database](/docs/generate/custom-vector-from-postgis/)). The easiest way is to convert your data into vector tiles and then [combine it with standard OpenMapTiles source in a map style](https://openmaptiles.org/docs/raster/custom-raster/#prepare-map-style). The big advantage of this approach is that you don't need to generate the whole OpenMapTiles schema which is quite time-consuming. | ||
You can combine OpenMapTiles with your custom vector data saved in **Shapefile** or **GeoJSON** format (there is a separate article for [data stored in **PostGIS** database](/docs/generate/custom-vector-from-postgis/)). The easiest way is to convert your data into vector tiles and then [combine it with a standard OpenMapTiles source in a map style](https://openmaptiles.org/docs/raster/custom-raster/#prepare-map-style). The big advantage of this approach is that you don't need to generate the whole OpenMapTiles schema which is quite time-consuming. | ||
|
||
# Create vector tiles from GeoJSON or ShapeFile | ||
## Preparation | ||
|
||
On Linux and macOS, you can use a command-line tool [**tippecanoe**](https://github.com/mapbox/tippecanoe) from Mapbox. See [installation instructions](https://www.mapbox.com/help/large-data-tippecanoe/#install-tippecanoe-and-gdal). | ||
On Linux and macOS, you can use a command-line tool [**tippecanoe**](https://github.com/felt/tippecanoe) originally from Mapbox. See [installation instructions](https://github.com/felt/tippecanoe?tab=readme-ov-file#installation). | ||
|
||
Before using tippecanoe, you need to transform your data into the EPSG:4326 coordinate system. You can use for example `ogr2ogr` utility which is part of [gdal](http://www.gdal.org/): | ||
|
||
Before using tippecanoe, you need to transform your data into EPSG:4326 coordinate system. You can use for example `ogr2ogr` utility which is part of [gdal](http://www.gdal.org/): | ||
```bash | ||
ogr2ogr -f GeoJSON your_data_in_4326.json -t_srs EPSG:4326 your_data.shp | ||
``` | ||
|
||
Having your data in correct coordinate system, you can do the conversion using tippecanoe. The most simple use case is: | ||
## Generate the Vector Tiles | ||
|
||
Having your data in a correct coordinate system, you can do the conversion using tippecanoe. The most simple use case is: | ||
|
||
```bash | ||
tippecanoe -o your_data.mbtiles your_data_in_4326.json | ||
tippecanoe -o tiles.mbtiles your_data_in_4326.json | ||
``` | ||
|
||
It will convert your data into MBTiles for zoom levels 0 to 14. Tippecanoe enables much more sophisticated options including layer and attribute management, dropping features, generalization, and more. See [documentation](https://github.com/mapbox/tippecanoe#options). | ||
It will convert your data into MBTiles for zoom levels 0 to 14. Tippecanoe enables much more sophisticated options, including layer and attribute management, dropping features, generalization, and more. See [documentation](https://github.com/felt/tippecanoe?tab=readme-ov-file#cookbook). | ||
|
||
You can visually check the generated MBTiles file using [TileServer-GL](/docs/host/tileserver-gl/): | ||
|
||
```bash | ||
docker run -it -v $(pwd):/data -p 8080:80 maptiler/tileserver-gl your_data.mbtiles | ||
make start-tileserver | ||
``` | ||
|
||
Data preview with TileServer-GL: | ||
<img src='/img/custom-vector-tileserver-gl.png' alt='Data preview with TileServer-GL' /> | ||
|
||
## Combine your vector tiles with OpenMapTiles | ||
|
||
After creating vector tiles, you can combine them with the standard OpenMapTiles layer in one map style. It can be done in the same way as in case of [raster tiles](/docs/raster/custom-raster/#prepare-map-style). | ||
|
||
## User-friendly software | ||
|
||
Alternatively, you can use commercial [map tiling software](https://www.maptiler.com/desktop/) with a user-friendly GUI to generate your vector data overlay. |
Oops, something went wrong.