OS DataHub Maps


A plugin to display UK Ordnance Survey maps with markers and tracks. This plugin is a successor to the OS OpenSpace Maps plugin and uses the same shortcode.

This plugin works using the [osmap] shortcode anywhere in your post, page or custom post type content. It allows maps with markers or GPX/KML files to be shown.

Using the new OS Data Hub API you can now view 1:50,000 Landranger and 1:25,000 Explorer maps.

The following attributes can be passed:

  • height="600" sets the height of the map div
  • width="800" sets the width of the map div. Omit this to use available width.
  • zoom="7" sets the initial zoom level
  • profile="175" sets the elevation profile height
  • color="red" or color="#ff0000" (colour is also acceptable) sets the colour of the track shown from a file.
  • track="3" sets the width of the track shown from a file.
  • gpx="http://www.example.com/myfile.gpx" specifies a gpx file to be displayed
  • kml="http://www.example.com/myfile.kml" specifies a kml file to be displayed
  • markers="NY1234512345;Marker 1|54.454198,-3.211527!red;Marker 2" a list of positions and (optionally) labels separated by | with a ; between the position and label. Positions can be 6, 8 or 10 figure grid references or decimal lat long. Labels, if present, must be simple text. Marker colour can be specified following a ! after the position.
  • markerfile="http://example.com/markers.txt" specifies a text file containing marker definitions, one per line. As above, position and label are separated by ;. In this case the label can include any text including HTML, should you wish to include links or other formatting.
  • centre="54.454198,-3.211527" sets the map centre point, to override the default centre or if not using markers or track files

There are 14 zoom levels available:

  • 0 Whole UK
  • 1 Half UK
  • 2 1:1M
  • 3 1:1M, zoom
  • 4 1:250,000
  • 5 1:250,000, zoom
  • 6 1:50,000 Landranger
  • 7 1:50,000 Landranger, zoom
  • 8 1:25,000 Leisure
  • 9 1:25,000 Leisure, zoom
  • 10 1:3,307 Detail
  • 11 1:1,654 Detail
  • 12 1:827 Detail
  • 13 1:413 Detail

Each zoom level is a factor of two higher then the previous one. Zoom 6 shows 1:50,000 Landranger maps at actual size, so zoom 8 is showing 1:25,000 Explorer maps at double scale.

To upload a KML or GPX file just use the WordPress media uploader and then copy the address of the uploaded file into the shortcode.


  • [osmap height="300" width="300" color="blue" gpx="http://www.example.co.uk/myfile.gpx"] displays a 300px by 300px window containing a blue track from the file specified.

  • [osmap markers="NY2000008000;Wasdale"]shows a default size and zoom window with a marker placed and the popup text „Wasdale“

Migration from OS OpenSpace Maps

Ordnance Survey is sunsetting the OpenSpace Maps service and it is expected to be switched off in August 2021. This plugin aims to give a seamless upgrade to use the new Data Hub Maps service instead. It uses the same shortcode and all the same attributes are supported.

The Data Hub service is a significant upgrade from OpenSpace, allowing use of the excellent 1:25,000 Explorer mapping. It also has a much more generous free data allowance, typically 2 million map views per month.

We are now using Leaflet.js to display maps, giving a cleaner and more responsive interface.

The plugin has also been upgraded with new features:

  • Full screen viewing option.
  • Elevation profiles from GPX data.
  • Better touch and mousewheel support, similar to Google Maps.
  • Ability to use both routes and markers on the same map.
  • Nine different marker colours available.
  • Option to restrict premium maps to logged-in users.

This plugin will detect whether the OpenSpace plugin is currently active and give way to it. In that case it hooks a test shortcode instead, [osmap_test]. This allows you to get to the settings page and check that everything is working on a test page. You can then disable the OpenSpace plugin and the Data Hub plugin will take over.


  • A 1:50,000 Landranger map embedded in a WordPress post
  • A map showing a GPX track and elevation profile
  • A 1:25,000 Explorer map
  • Highly detailed street-level views are also available
  • Zoomed out to 1:1M scale
  • The defaults settings page
  • The global settings page


  1. Go to the Plugins page in the admin area, search for datahub navigate to the plugin page and click install.
  2. Or download and extract os-datahub-maps.zip into the /wp-content/plugins/ directory. This will create a subfolder called os-datahub-maps containing the plugin files.
  3. Activate OS Maps through the ‚Plugins‘ menu in WordPress
  4. Before the plugin will work you need to add your API key to the settings page on the dashboard.
  5. If you are running WordPress Multisite you (or your network administrator) will have to add KML and GPX files to the allowed file types under ‚Network Settings‘ if you wish to upload these files.


Is this compatible with OS OpenSpace Maps?

As far as possible, yes. The new Data Hub mapping service is very different from the OpenSpace service, but we have tried to maintain compatibility as far as possible. All being well you should be able to install the new plugin, set the API key and a few defaults. WHen you disable the OpenSpace plugin, this one should just populate the existing shortcodes in the same way.

Where can I get support?

You can find more information on the plugin homepage

Ask questions in the support forum on the WordPress plugin page


3. November 2020
The plugin is really simple to use and the it's great to have OS Maps embedded in your WordPress site. Most importantly, the plugin is really well supported and updated regularly.
27. Oktober 2020
I used the plugin from Simon for the old OS solution and now I am using the new one. Simon provides fast fixes and comprehensive and friendly feedback. Thanks!
Lies alle 3 Rezensionen

Mitwirkende & Entwickler

„OS DataHub Maps“ ist Open-Source-Software. Folgende Menschen haben an diesem Plugin mitgewirkt:


Übersetze „OS DataHub Maps“ in deine Sprache.

Interessiert an der Entwicklung?

Durchstöbere den Code, sieh dir das SVN Repository an oder abonniere das Entwicklungsprotokoll per RSS.



  • Fix zoom when displaying a single marker.


  • Fix display of a single marker when marker colour is specified.
  • Change style tags to allow better co-existence with OpenSpace maps during testing.
  • Changes to internal directory structure.


  • Reimplement elevation profile hiding to avoid display with fixed 600px width in some browsers.


  • Use the default marker for waypoints in GPX files.
  • Hide elevation profile if there is no data to show.


  • Fix a regression in the fullscreen button CSS


  • Allow base-relative URLs and alternate scheme URLs
  • Add option to restrict panning to 45% of map width and height to avoid excessive tile usage
  • Add license files for all 3rd party components
  • Update to leaflet-elevation 1.3.7 to fix problem with multiple profiles on one page
  • Use leaflet-gpx in place of omnivore for GPX maps to ensure routes are processed as well as tracks
  • Improve CSS specificity to avoid some misalignments


  • Fix double escaping of HTML in marker files
  • Ensure theme doesn’t add box shadow to map tiles and markers


  • Fix setting colour of elevation profiles
  • Avoid code re-ordering when used with caching plugins
  • Add version query to CSS and JS file fetches for cache busting


  • Initial version, a ground-up rewrite to replace the plugin for the deprecated OS OpenSpace Maps service.