A plugin to display UK Ordnance Survey OpenSpace maps with markers and tracks.
This plugin works using the
shortcode anywhere in your post, page or custom post type content. It allows maps with markers and To see this map cookies and javascript must be enabled. If you are still having trouble after having checked both of these please contact us using the link at the top of the page
gpx or kml files to be shown. Examples are available at ButNoIdea.co.uk and my blog.
The following parameters can be passed:
height="xxx"sets the height of the map divwidth="xxx"sets the width of the map divcolour="red"orcolour="#ff0000"(coloris also acceptable) sets the colour of the track shown from a file.gpx="http://www.example.com/myfile.gpx"specifies a gpx file to be displayedkml="http://www.example.com/myfile.kml"specifies a kml file to be displayedmarkers="NY1234512345;Marker 1|54.454198,-3.211527;Marker 2"a list of positions and labels separated by|with a;between the position and label. Positions can be 6, 8 or 10 figure grid references or decimal lat long.
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.
Examples
-
displays a 300px by 300px window containing a yellow track from the file specified.To see this map cookies and javascript must be enabled. If you are still having trouble after having checked both of these please contact us using the link at the top of the page
-
shows a default size and zoom window with a marker placed and the popup text “Wasdale”To see this map cookies and javascript must be enabled. If you are still having trouble after having checked both of these please contact us using the link at the top of the page
Download (693 downloads)
Latest version: Download OS OpenSpace Maps v1.2.3 [zip]
Installation
- Go to the Plugins page in the admin area, search for
openspacenavigate to the plugin page and clickinstall. - Or download and extract
os-openspace-maps.zipinto the/wp-content/plugins/directory. This will create a subfolder calledos-openspace-mapscontaining the plugin files. - Activate
OS OpenSpace Mapsthrough the ‘Plugins’ menu in WordPress - Before the plugin will work you need to add your API key to the settings page on the dashboard.
- 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’.
FAQ
Q. Where can I get support?
A. In the comments section at the plugin page
Q. Where is the rest of the FAQ?
A. This will be extended in due course.
Q. Planned for the future
A.
- Multiple kml and gpx files
- A Shortcode Generator
Changelog
1.2.3
- CSS fix for stripy map tiles after the OS changed OpenSpace
1.2.2
- Fixed problem with WordPress versions earlier then 3.3
- Added hooks and filters to allow plugins to modify output
- Added proxy for GPX and KML files not on the wordpress host
1.2.1
- Bug Fix
1.2
- Multiple markers with auto zoom
- API key checking
- New help tabs added to options and post editing screens
- Add multiple maps to post or pages
- Able to use lat long for markers
1.1.1
- Bug Fix
1.1
- Only adds one row to the options table
- Fixed feed bug
1.0
- Initial Release
Hi there,
I get an error when the plugin is activated and I try to edit a page. It complains about an add help function on line 34. Any ideas?
Love the idea of the plugin – I want to use OS maps rather than Google maps if possible.
Hi Mark,
Thank you for giving my plugin a try and for the feedback. Are you using WordPress 3.3 or 3.3.1? I think this may be a problem caused by using an older version of WordPress. I will release a bug fix that only trys to add the help tabs if the version supports them (3.3+).
Cheers Jon
This has fixed the problen, I will add the change in he next update. In the meantime if anybody using an earlier version of wordpress would like the fixed verson leave a comment.
Hi Jon,
Thanks for developing this plugin, but I can’t get it to work. It demonstrates a map, once you click in, but no gpx file (they work with other plugins).
Here’s the link http://www.walkupsnowdon.co.uk/?p=320 to where I’m trying to get it to work ( using the code [osmap gpx="http://www.walkupsnowdon.co.uk/wp-content/uploads/2011/09/SR-and-Cynghorion.gpx"] )
Cheers!
BTW – are you willing to do some paid mods on this plugin?
Hi Dave,
I have found out what is causing the problem. There is a bug in OpenLayers (on which OpenSpace is based) which cannot cope with empty tags in the gpx file – see http://lists.osgeo.org/pipermail/openlayers-users/2011-April/020130.html
Removing two empty desc tags from your gpx file solves the problem see – http://jonlynch.co.uk/testing/. Interestingly I use memorymap to generate my gpx files and it does not have his problem,
Since the OpenSpace library is delivered from the Ordnance Survey it is not possible to fix the bug in openlayers directly. For the moment I hope that removing the empty tags manually is good enough.
I would be happy to do some paid work on the plugin, what are you after?
Cheers
Jon
Thanks Jon that’s really appreciated,
That works great – I’ve just got to change about 600 of them now! I’ll have to change the shortcode on each page anyway, so it’ll do it at the same time.
What I’m after –
An Elevation Profile, with height, time and ascent and a link to download the gpx file – basically what I’ve already got plus time logged in the gpx file – I’d see it as something you may well want to add to the plugin anyway – so I’m happy to sponsor it and for it to be made available as part of the plugin.
An example can be seen here: http://www.mudandroutes.com/archives/routes/snowdon-south-ridge-and-moel-cynghorion
I don’t really mind if it’s got that icon following the route or not – being able to use OS maps would outweigh that!
I’ve got a few more ideas too, I’ll run them by you too if you want (They’re a little more advanced).
Hwyl
Dave.
A suggestion for editing 600 files is to use NotePad++ or a similar editor and do a find in files to remove the empty <desc> tags.
Hope this helps
Jon
I have gone to map builder and copied the code and pasted it into the html box for the page of http://www.pyonsgroup.co.uk/?page_id=1243 and I have installed the wordpress openspace plugin, activated it and pasted in my api key but all I get is an empty box when the page loads. Any ideas? Any help much appreciated. Harry
Hi Harry,
My plugin is not designed to be used with the webmap builder. It works using shortcodes like [osmap markers="NY21600720;Scafell Pike|NY18600880;Wasdale Head"] or [osmap kml="http://www.example.com/my_file.kml"] If you go to your edit post page and then click on help you should find some instructions. To use the webmap builder code you need a raw html plugin. I think there was some instuctions on the OS OpenSpace site.
Hope this helps, Jon
I’ve now recorded a video at http://www.youtube.com/watch?v=95QnRbbwcJ0&feature=youtu.be
oh sorry i posted the above post before i realised you’d already replied to my earlier one!
Initially I just pasted the code from the mapbuilder into the html editor box for the page but when you load the page it just shows an empty box. I tried downloading your plug in and I also downloaded the raw html plugin respectively, but I’m confused as to what both actually do because all I can do on your plug in is set a few parameters, and as far as raw html I can input html text into the box anyway. Maybe you could give me some very basic html script I can put in just to see that it will actually show a map to start with! Would be great if you could help. Thanks. Harry
Hi. I’m still trying to get my map working. I’m going with your plugin at the moment because the map builder just doesn’t work. The only thing I can get so far with your plugin activated and putting in various examples of you shortcode is an empty box with the os symbol in the corner and the navigation buttons but no map. I notice that in the plugin settings under map defaults there isn’t an option for setting ‘default map centre’ and just wondered if this might have something to do with it? I have put in my api key but it still says ‘You must register with the Ordinance Survey for an API key here before using this plugin’ but maybe it says this anyway?
I’ve had a look at http://www.pyonsgroup.co.uk/?page_id=1243 and it seems that strange <p> tags are being added to the map javascript. (see line 189 of the page I linked too). I think another plugin has delayed the calling of the autop function which normally runs before shortcodes are processed. This could even be the raw html plugin. I would disable any unused plugins and then look at lines 189/190 there should not be any p tags. Then depending on how much you would like this to work try disabling other plugins that filter your content. Sorry i can’t be more help.
Jon
Hi i am trying to link to some marker info, but can’t seem to get it to work.
[osmap markers="ST3430362661;Mapping Social Enterprise"]
is it possible to link to the text? If so, how?
Thanks….
If you want to add a link into your text just use html but use single quotes for the href attribute, for example: [osmap markers="ST3430362661;<a href='http://www.example.com'>Mapping Social Enterprise</a>"]
Hope this helps
Thanks for helping with linking to a url. I did have a few issues getting into post as the code will only work when you are in “html” mode, rather than “visual”.
Hi,
I’m porting our site (which uses OS Maps) to WordPress.
I’ve installed your plugin and I can get it working a shortcode, what I wanted to do was embed it in a php template. Is that possible?
I tried calling osmap_generator($args) but that doesn’t work. Do I need to call some other init functions on the page too?
I also tried do_shortcode(‘[osmap]‘); but that didn’t work either.
– current site http://www.in-a-tent.co.uk/outlet/32
- new site – http://dev.in-a-tent.co.uk/shop/2032/millets/aberdeen/
Doh! I forgot the echo
echo osmap_generator($args);works a treat
Hmm got the map to appear but it’s not centring properly.
http://dev.in-a-tent.co.uk/shop/2032/millets/aberdeen/
It’s placing the marker correctly.
The lat, long is printed above the map.
I fixed the centering by editing os-openspacemaps.php and changing line 249 from
osMap' . $mapid . '.setCenter( NGR2NE ("' . $centre . '"), ' . $zoom . ');toosMap' . $mapid . '.setCenter( CONVERT ("' . $centre . '"), ' . $zoom . ');Hi Andy, I am glad you managed to get it working in a template. Very sorry about the lack of replies but I’ve been away on a family holiday for the last week. I will update the plugin with your fix and add your use to the FAQ in the next release.
Cheers
Jon
Hi,
I just got the plugin installed, worked first time, its brilliant.Thank you for doing this.
Is there a short code to get the elevation profile showing?
Thanks
Rob
Hi Jon
Working for Ordnance Survey and using their OS Openspace maps for a while now in a WordPress site, I was very pleased to see your plugin; thank you for your work with this.
I’ve set up a test page and it loads the map and reads in a gpx file to display the route. However, I can’t get a marker to show.
Here’s the code:
[osmap height="600" width="600" color="red" markers="SU275085;Start" gpx="http://www.bikesandboots.co.uk/tracks/20110319newforest.gpx"]
and here’s the test page:
http://www.bikesandboots.co.uk/blog/?p=296
I’ve tried a different theme to see if that made any difference but it hasn’t.
I hope you can help!
Thanks in anticipation
Alan
Hi Alan,
Thanks for your comment. I’m afraid at the moment the plugin either shows markers or a track but not both. I will try to get this working in a future update.
Cheers
Jon
Hi Jon
Oh, OK.. thanks anyway! Good luck!
I’m sorry for the slow response to your help; I’ve been on holiday.
Alan
Hi Jon,
Great plugin
Is there anyway to make it use the blue or green markers from OpenSpace instead of always the red ones? I’ve had a look through the php code, but can’t find anything that sets anything but the route colour.
Hope you can help.
Cheers
Jonathan
Hi Jon
I can get markers to work but not gpx or kml files. Nothing appears in the map frame and then when I click on the map it defaults to somewhere near Berwick Upon Tweed (a 00 grid ref maybe?).
I checked there are no empty tags in the gpx file. I’ve deactivated all other plugins and tried different themes. I’m not an expert, so now I’m stuck.
Any help would be really appreciated!
Phil
Hi Phil,
Have you checked your kml or gpx files are actually accessible on a web browser at the address you are using in the shortcode? Just put the address in your browser and check they are accessible. If they are can you please either publish a post so I can take a look or let me know the whole shortcode you are trying to use. The Berwick thing always happens when the map has nothing to auto zoom to.
Good luck
Jon
I had the same problem but figured it out. I was making the mistake of using an address in the shortcode without the ‘www.’ at the beginning whereas my site showing as being on ‘www.’. This was making the proxy kick in and my GPX files weren’t displaying.
I’ve not tested putting the gpx on a different domain entirely to see if it was a proxy problem or not but hopefully this will help someone else.
Great plugin by the way, thanks!
Hi Jon
Appreciate your reply and sorry for disappearing on you!
I’ve finally sussed out how to get it working. I had to change the file extension to xml and then upload manually to my website’s server (as the WordPress media uploader doesn’t like xml files). I’m not technically minded so I’ve no idea why or what this means – but it works!
Great plugin, thank you. And Ordnance Survey maps are still the best.
Phil
Hi,
Something odd has happened with maps displayed using the plugin, the map background appears stretched and has white spaces the same size as the map tiles striped down the maps produced. This doesn’t just seem to be affecting my blog, but seems apparent on your blog also (for example see the map associated with http://jonlynch.co.uk/2012/03/dale-head/).
Any ideas what might be wrong?
Cheers,
Adam
Thanks Adam, the problem is that after an update by the Ordnance Survey the CSS required for the map tiles now needs max-width:none; (or at least 250%). Many wordpress themes set a max width for all images and that is interfering with the map. I will release an update in the next day or two fixing this.
Jon
Ah that’s brilliant thanks, I’ve updated the CSS for the plugin in my installation and that seems to have done the trick.
Cheers for the help, and thanks for the awesome plugin!
A
I’ve got the same “stripey” effect too now!
An update would be terrific, thank you.
Update: I went into the plugin’s CSS file and changed max-width:100% to max-width:none, and it seems to have done the trick.
I have just submitted the update to the Plugin repository, it should not make any difference now you have updated but for others with the problem it should fix it.