All integrations OpenLayers React WordPress API docs
ol-mapbox-style package reads the style document and builds the layers for you. This map is live OpenLayers.From a CDN for a quick start, or npm install ol ol-mapbox-style for a bundled app.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ol@10.2.1/ol.css">
<script src="https://cdn.jsdelivr.net/npm/ol@10.2.1/dist/ol.js"></script>
<script src="https://cdn.jsdelivr.net/npm/ol-mapbox-style@12.3.5/dist/olms.js"></script> olms.apply creates the map, reads the style, adds the vector tile source and every layer, and resolves with the OpenLayers Map so you can keep working with it as normal.
<div id="map" style="width: 100%; height: 400px;"></div>
<script>
olms.apply("map", "https://tiles.expressmaps.com/styles/standard.json?key=YOUR_API_KEY")
.then(function (map) {
map.getView().setCenter(ol.proj.fromLonLat([-0.1276, 51.5072]));
map.getView().setZoom(12);
});
</script> import "ol/ol.css";
import { apply } from "ol-mapbox-style";
import { fromLonLat } from "ol/proj";
const map = await apply("map", "https://tiles.expressmaps.com/styles/standard.json?key=YOUR_API_KEY");
map.getView().setCenter(fromLonLat([-0.1276, 51.5072]));
map.getView().setZoom(12); Everything after apply is plain OpenLayers. Add a vector layer with a point feature and your own icon:
import VectorLayer from "ol/layer/Vector";
import VectorSource from "ol/source/Vector";
import Feature from "ol/Feature";
import Point from "ol/geom/Point";
import { Icon, Style } from "ol/style";
const marker = new Feature(new Point(fromLonLat([-0.1276, 51.5072])));
marker.setStyle(new Style({ image: new Icon({ src: "/pin.png", anchor: [0.5, 1] }) }));
map.addLayer(new VectorLayer({ source: new VectorSource({ features: [marker] }) })); Call apply again with a different style URL on the same map, or create the map once per style. All ten styles share one tileset, so switching is instant and does not use extra map loads.
name:latin for labels. ol-mapbox-style handles the expressions; you do not need to change anything.tiles.expressmaps.com is reachable from the page.