PHPackages                             burnthebook/craft3-osmaps - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. burnthebook/craft3-osmaps

ActiveCraft-plugin[Utility &amp; Helpers](/categories/utility)

burnthebook/craft3-osmaps
=========================

Allows you to display Ordnance Survey maps on your Craft CMS website.

3.0.0(1y ago)01.1kMITCSSCI failing

Since Dec 4Pushed 1y ago2 watchersCompare

[ Source](https://github.com/Burnthebook/craft3-osmaps)[ Packagist](https://packagist.org/packages/burnthebook/craft3-osmaps)[ RSS](/packages/burnthebook-craft3-osmaps/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (2)Versions (16)Used By (0)

OS Maps plugin for Craft CMS 5.x
================================

[](#os-maps-plugin-for-craft-cms-5x)

Allows you to display Ordnance Survey maps on your Craft CMS website.

Requirements
------------

[](#requirements)

This plugin requires [PHP](https://www.php.net/) 7.4 - 8.2 and supports [Craft CMS](https://www.craftcms.com/) 3.x, 4.x and 5.x.

OS MapsCraft 3Craft 4Craft 51.x✅❌❌2.x❌✅❌3.x❌❌✅Installation
------------

[](#installation)

To install the plugin, follow these instructions.

1. Open your terminal and go to your Craft project:

    ```
    cd /path/to/project

    ```
2. Then tell Composer to load the plugin:

    ```
    composer require burnthebook/craft3-osmaps

    ```
3. In the Control Panel, go to Settings → Plugins and click the “Install” button for OS Maps.

Configuration
-------------

[](#configuration)

1. Add your OS Maps API Key on the plugin's settings page in the Control Panel.
2. Set a Max Zoom Level value. This is usually 10 if you are not allowed to display the OS MasterMap Topography Layer.

Using OS Maps
-------------

[](#using-os-maps)

Add the following to your twig template and modify where necessary.

```
{% do view.registerAssetBundle("Burnthebook\\OSMaps\\assetbundles\\OSMaps\\OSMapsAsset") %}

{% set tileUrl = craft.osMaps.getApiUrl() %}
{% set maxZoomLevel = craft.osMaps.getMaxZoomLevel() %}
{% set zoomLevel = 10 %}
{% set lat = 52.921309 %}
{% set long = -1.475118 %}

{% js %}
    var map = createOSMap('map', '{{ tileUrl }}', { maxZoom: {{ maxZoomLevel }} });
    var latlng = [{{ lat }}, {{ long }}];

    map.setView(latlng, {{ zoomLevel }});
    L.marker(latlng).addTo(map);
{% endjs %}
```

See the [Leaflet Documentation](https://leafletjs.com/reference-1.0.3.html) for reference on using the `L` JavaScript object.

Note that the `createOSMap()` function returns a Leaflet Map object.

Advanced usage
--------------

[](#advanced-usage)

The `getApiUrl()` method accepts an object with options.

See the [OS Maps Documentation](https://apidocs.os.uk/docs/os-maps-wmts) for more details.

The default options we define are:

```
{% set tileUrl = craft.osMaps.getApiUrl({
    'service': 'WMTS',
    'request': 'GetTile',
    'version': '1.0.0',
    'layer': 'Road 27700',
    'style': 'true',
    'format': 'image/png',
    'tileMatrixSet': 'EPSG:27700',
    'tileMatrix': 'EPSG:27700:{z}',
    'tileRow': '{y}',
    'tileCol': '{x}'
}) %}
```

If you are using Google Maps in the Control Panel (e.g. Maps plugin), you will want to convert the Google Maps zoom level to an OS Maps zoom level:

```
{% set zoomLevel = craft.osMaps.convertGMapsZoomLevel(entry.map.zoom) %}
```

The JavaScript function `createOSMap()` accepts the following parameters:

- id : ID of the Map's HTML element
- tileUrl : URL to fetch tiles from
- tileLayerOptions : Options for the Leaflet TileLayer object. See the Leaflet documentation for more details.
- mapOptions : Options for the Leaflet Map object. See the Leaflet documentation for more details.
- crs : An optional CRS object. See the Leaflet and/or Proj4leaflet documentations for instructions on creating a CRS object. It's fairly complicated. We provide a default CRS object for EPSG:27700

The function returns a standard Leaflet Map object. Do with it as you wish.

The Leaflet library (`L` object in JS) is also globally exposed should you wish to use it e.g. for adding markers or manipulating the map.

A note on performance
---------------------

[](#a-note-on-performance)

We are proxying all tile requests via the plugin (Craft) in order to keep the OS API key hidden from the public. This isn't the best approach from a performance perspective, however it is required by OS.

To illustrate this:

Map (front-end) &lt;--&gt; OS Maps Plugin (Craft) &lt;--&gt; OS Maps API

When users interact with a map (zooming/panning) this will trigger lots of requests to your server - one request for each tile to be more precise! If you have lots of users and lots of maps on your site, this could become a problem!

A possible solution would be to place your website over a CDN e.g. CloudFlare and enable full-page caching on all requests to `/actions/os-maps/api/*`, where `/actions/` is your [actionTrigger](https://docs.craftcms.com/v3/config/config-settings.html#actiontrigger) config setting (`actions` by default).

Just note that you'd have to clear the CDN cache when/if OS update any tiles.

Useful resources
----------------

[](#useful-resources)

-
-
-
-

---

Brought to you by [Burnthebook](https://www.burnthebook.co.uk)

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance43

Moderate activity, may be stable

Popularity14

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 75% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~189 days

Recently: every ~334 days

Total

11

Last Release

453d ago

Major Versions

1.2.5 → 2.0.02023-05-26

2.0.0 → 3.0.02025-02-12

### Community

Maintainers

![](https://www.gravatar.com/avatar/d39c603a5be3e48327795a4557e3008c4c9f5e19496db2949be7b5fe7da5f1e0?d=identicon)[burnthebook](/maintainers/burnthebook)

---

Top Contributors

[![MadMikeyB](https://avatars.githubusercontent.com/u/831828?v=4)](https://github.com/MadMikeyB "MadMikeyB (9 commits)")[![Rees1993](https://avatars.githubusercontent.com/u/50775373?v=4)](https://github.com/Rees1993 "Rees1993 (3 commits)")

---

Tags

cmsCraftcraftcmscraft-pluginordnance surveyos maps

### Embed Badge

![Health badge](/badges/burnthebook-craft3-osmaps/health.svg)

```
[![Health](https://phpackages.com/badges/burnthebook-craft3-osmaps/health.svg)](https://phpackages.com/packages/burnthebook-craft3-osmaps)
```

###  Alternatives

[verbb/navigation

Create navigation menus for your site.

90683.7k17](/packages/verbb-navigation)[verbb/formie

The most user-friendly forms plugin for Craft.

101372.9k40](/packages/verbb-formie)[verbb/comments

Add comments to your site.

13753.1k](/packages/verbb-comments)[verbb/tablemaker

Create customizable and user-defined table fields.

40168.8k1](/packages/verbb-tablemaker)[supercool/tablemaker

Create customizable and user-defined table fields.

40141.7k](/packages/supercool-tablemaker)[pennebaker/craft-architect

CraftCMS plugin to generate content models from JSON/YAML data.

72148.5k5](/packages/pennebaker-craft-architect)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
