mirror of
https://github.com/maplibre/martin.git
synced 2024-12-19 04:41:46 +03:00
Add using-with-openlayers document (#1150)
Try to help #1132 --------- Co-authored-by: Yuri Astrakhan <yuriastrakhan@gmail.com>
This commit is contained in:
parent
10903d2d9a
commit
72a0a5dfbb
@ -21,6 +21,7 @@
|
|||||||
- [Using with Leaflet](using-with-leaflet.md)
|
- [Using with Leaflet](using-with-leaflet.md)
|
||||||
- [Using with deck.gl](using-with-deck-gl.md)
|
- [Using with deck.gl](using-with-deck-gl.md)
|
||||||
- [Using with Mapbox](using-with-mapbox.md)
|
- [Using with Mapbox](using-with-mapbox.md)
|
||||||
|
- [Using with OpenLayers](using-with-openlayers.md)
|
||||||
- [Recipes](recipes.md)
|
- [Recipes](recipes.md)
|
||||||
- [Tools](tools.md)
|
- [Tools](tools.md)
|
||||||
- [martin-cp bulk tile generation](martin-cp.md)
|
- [martin-cp bulk tile generation](martin-cp.md)
|
||||||
|
16
docs/src/using-with-openlayers.md
Normal file
16
docs/src/using-with-openlayers.md
Normal 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);
|
||||||
|
```
|
Loading…
Reference in New Issue
Block a user