× Forum for the GPXTrackMap Content Plugin for Joomla! 2.5 and 3.x

Adding Ordanance Survey map layer option

akendall1966 replied the topic: Adding Ordanance Survey map layer option

6 years 11 months ago

Hi Frank,

Yes it is going to be an either / or choice, I tried to use layers so it would be switchable using the layer switcher function. But the projection systems used to create the map images are fundamentally different and incompatible.

en.wikipedia.org/wiki/Transverse_Mercator has a couple of images that illustrate the difference between transverse and spherical Mercator. Can't say I truly understand it, but as the UK is relatively tall narrow island the transverse system used work well over that limited area but not too well for a worldwide map. Seems the openSpace API handles the WGS84 to UK nationalgird, so the same code for the lgpx layer overlays the track accurately in either form.

Your correct there needs to be a key registered to the base url of the site using the data. So an additional parameter and a switch are needed.

Please Log in or Create an account to join the conversation.

fingeradmin replied the topic: Adding Ordanance Survey map layer option

7 years 11 hours ago

Hi Adrian,

looking at the javascript code in your test page, this seems like a doable option, but: As this happens when creating the map object, it would be an either/or setting, i.e. you could not dynamically switch between the OSM/Google and OSGB layers using the map switcher - as far as i can see, but maybe there's some trick that would do it.

In the code there's this line:

projection: "EPSG:4326"

- so i thought you would just have to pass in a different argument for the OSGB projection, but honestly i don't know much about that stuff. Maybe the forum at OpenLayers.org could help you here...


Another thing: in the <head> section where you include the openspace srcipt, there's a key that you pass in. Is this so that you first have to register with OSGB, and then you get the key that you can use? (i guess so, it's also how Bing maps work...)
Then of course the plugin would need another configuration parameter where everyone could enter his/her key... (that's not a showstopper, but just yet another parameter.) ;)

...and yes, keep us informed, please!

cheers, Frank

Please Log in or Create an account to join the conversation.

akendall1966 replied the topic: Adding Ordanance Survey map layer option

7 years 12 hours ago

A bit more research I have learned that the OSGB maps use a different projection system to the google Spherical Mercator google and OSM use for thier map servers. So it is not possible to insert the OSGB maps tile into an openLayer map as they just appear in the wrong place.

It could be done by creating a map server and reprojecting the OSGB raster images onto the spherical mercator projection. But the OS map servers don't offer this at present.

So the most practical approach is to switch between openSpace and OpenLayers at the point you create the map object. Both APIs can use the openLayers.Layer.Vector construct, so adding the gpx shares the same code.

I have created a test page www.kendalla.f2s.com/test/ to demonstrate the principal. Its a bit of a fudge in that the raido button force a page reload to change the map between OSGB and OSM.

For my puprposes it could be a simple hack to include the OpenSpace API and change OpenLayers.map('map name') construct to openSpace.map('map name'). Would be nicer if it were configurable choice for administering the extension.

I'll let you know how I get on...

AK

Please Log in or Create an account to join the conversation.

fingeradmin replied the topic: Adding Ordanance Survey map layer option

7 years 5 days ago

Hi Adrian,

looks nice! As for the grid system, OpenLayers is pretty flexible in transforming coordinate systems - though i don't know much about it :)

If you have trouble with the code, let me know - this is my first PHP project, so there may well be some "room for improvement" there ;)

well then, let us know how it goes!

cheers, Frank

Please Log in or Create an account to join the conversation.

akendall1966 replied the topic: Adding Ordanance Survey map layer option

7 years 6 days ago

Thanks for the green light Frank,

Yes OS are a UK government org that are responsible for survey and mapping the UK. The UK government made most of the digital mapping data free to use as few years back under the OpenData initiative.

More info and API documentation here if your interested: www.ordnancesurvey.co.uk/oswebsite/web-s...i/documentation.html

You can see a little project I have done here using it www.kendalla.f2s.com .

I'll have a look at your code and probably be back with questions as they arise. Biggest complication I expect will be the OS maps use OSGB grid system not Lat/lon so there will need to be some conversions to center the map and any track / way points.

Regards
Adrian

Please Log in or Create an account to join the conversation.

fingeradmin replied the topic: Adding Ordanance Survey map layer option

7 years 6 days ago

Hi there,

as long as they are free and open, i have no problem with adding those maps as an option.

As for extending the code - i don't mind if you "hack my code" - it's Open Source anyway, so feel free!

The code itself is made up from layer definitions that get assembled in the onContentPrepare method, you should be able to find it easily. What i usually do is make a (dumb, static, non-Joomla) html test page where i can test the JavaScript code, and when it works i take it apart and put the code to assemble the layer definition in the plugin code.

What i can not tell: you say they use an extension to the OpenLayers API, that would probably have to go into the <head> part of the page. This could be as easy as it is with OpenLayers itself (code is in the plugin, close to the start of the source), but it could be quite different...

(i'm a bit short on time, but if you need help i'll see what i can do.)

Cheers, Frank

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum