Add using-with-openlayers document (#1150)

Try to help #1132

---------

Co-authored-by: Yuri Astrakhan <yuriastrakhan@gmail.com>
This commit is contained in:
Lucas 2024-01-25 05:49:58 +08:00 committed by GitHub
parent 10903d2d9a
commit 72a0a5dfbb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 0 deletions

View File

@ -21,6 +21,7 @@
- [Using with Leaflet](using-with-leaflet.md)
- [Using with deck.gl](using-with-deck-gl.md)
- [Using with Mapbox](using-with-mapbox.md)
- [Using with OpenLayers](using-with-openlayers.md)
- [Recipes](recipes.md)
- [Tools](tools.md)
- [martin-cp bulk tile generation](martin-cp.md)

View File

@ -0,0 +1,16 @@
## Using with OpenLayers
[OpenLayers](https://github.com/openlayers/openlayers) is an open source library for creating interactive maps on the web. Similar to [MapLibre GL JS](https://maplibre.org/), it can also display image and vector map tiles served by Martin Tile Server.
You can integrate tile services from `martin` and `OpenLayers` with its [VectorTileLayer](https://openlayers.org/en/latest/apidoc/module-ol_layer_VectorTile-VectorTileLayer.html). Here is an example to add `MixPoints` vector tile source to an OpenLayers map.
```js
const layer = new VectorTileLayer({
source: new VectorTileSource({
format: new MVT(),
url: 'http://0.0.0.0:3000/MixPoints/{z}/{x}/{y}',
maxZoom: 14,
}),
});
map.addLayer(layer);
```