Skip to content

Commit dd97e1f

Browse files
committed
Merge branch 'main' of github.com:hyperknot/openfreemap
2 parents 74f00d6 + fd78d27 commit dd97e1f

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
## Using OpenLayers
2+
3+
[ol-mapbox-style](https://openlayers.org/ol-mapbox-style/) is an OpenLayers add-on that creates a layer group from a Mapbox/MapLibre style.
4+
5+
Include the following links and scripts in your page:
6+
7+
```html
8+
<!-- OpenLayers -->
9+
<script src="https://unpkg.com/ol/dist/ol.js"></script>
10+
<link rel="stylesheet" href="https://unpkg.com/ol/ol.css">
11+
12+
<!-- ol-mapbox-style -->
13+
<script src="https://unpkg.com/ol-mapbox-style/dist/olms.js"></script>
14+
```
15+
16+
Initialize it to a div like this:
17+
18+
```html
19+
<div id="map" style="width: 100%; height: 500px"></div>
20+
<script>
21+
const openfreemap = new ol.layer.Group();
22+
const map = new ol.Map({
23+
layers: [openfreemap],
24+
view: new ol.View({center: ol.proj.fromLonLat([13.388, 52.517]), zoom: 9.5}),
25+
target: 'map'
26+
})
27+
olms.apply(openfreemap, 'https://tiles.openfreemap.org/styles/liberty');
28+
</script>
29+
```

website/src/pages/quick_start.astro

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { Content as LeafletText } from '../content/how_to_use/leaflet.md'
99
import { Content as MapboxText } from '../content/how_to_use/mapbox.md'
1010
import { Content as MaplibreText } from '../content/how_to_use/maplibre.md'
1111
import { Content as MobileText } from '../content/how_to_use/mobile.md'
12+
import { Content as OpenLayersText } from '../content/how_to_use/openlayers.md'
1213
import { Content as SelfHostingText } from '../content/how_to_use/self_hosting.md'
1314
---
1415

@@ -32,6 +33,7 @@ import { Content as SelfHostingText } from '../content/how_to_use/self_hosting.m
3233
<MaplibreText />
3334
<MapboxText />
3435
<LeafletText />
36+
<OpenLayersText />
3537
<MobileText />
3638
<CustomStylesText />
3739
<SelfHostingText />

0 commit comments

Comments
 (0)