OS OpenSpace [logo]

OS OpenSpace Forum » OS OpenSpace » Newbie Area

Thread: Help with creating routes

Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 33 - Pages: 3 [ Previous | 1 2 3 | Next ] - Last Post: 16-Jun-2010 23:32 by: andyuk63
OS OpenSpace Team

Posts: 1,112
Registered: 31/01/08
Re: Help with creating routes
Posted: 14-May-2008 18:05   in response to: DRC2008
  Click to reply to this thread Reply

Hi,

There may indeed be some technical issue about printing, it was never in scope of the original project and so was unfortunately never tested. There is some information here: http://trac.openlayers.org/wiki/Printing but I suspect different browsers will behave very differently.

Regards,

Andy.

ebygomm

Posts: 39
Registered: 03/04/08
Re: Help with creating routes
Posted: 04-Jun-2008 22:10   in response to: rgphilpott
  Click to reply to this thread Reply

Thanks for this, after realising that my method of taking my gpx files from gps unit into memory map was stripping a load of waypoints out I'm going to move over to displaying direct from gpx and these instructions were a big help.

Just one thing, I'd like to display the routename which is also the filename of the gpx file as a title for the map. How do i go about doing this?

e.g. I want it to display wharncliffe where it says filename on this page
http://www.mikkel.org.uk/myownlittleworld/test3.html?f=wharncliffe.gpx

Thanks

rgphilpott

Posts: 146
Registered: 18/06/12
Re: Help with creating routes
Posted: 05-Jun-2008 21:52   in response to: ebygomm
  Click to reply to this thread Reply

Firstly, add an id to the heading in the HTML file:

<h2 id="pageheading">Filename</h2>

Then, in the init() function in maps.js, add:

var heading = document.getElementById("pageheading");
heading.innerHTML = fileName.substring(0, fileName.length - 4);


Note that because of the bug discussed in this thread:

http://openspace.ordnancesurvey.co.uk/openspaceforum/thread.jspa?threadID=96&tstart=0

your page doesn't currently work in the latest versions of Firefox and Safari.

The workaround is to add the following code to maps.js (also in the init() function):

OpenLayers.Renderer.SVG.prototype.supported = function() {
var svgFeature = "http://www.w3.org/TR/SVG11/feature#";
return (document.implementation &&
(document.implementation.hasFeature("org.w3c.svg", "1.0") ||
document.implementation.hasFeature(svgFeature + "SVG", "1.1") ||
document.implementation.hasFeature(svgFeature + "BasicStructure", "1.1") ));
};


ebygomm

Posts: 39
Registered: 03/04/08
Re: Help with creating routes
Posted: 05-Jun-2008 22:23   in response to: rgphilpott
  Click to reply to this thread Reply

I'll try that over the weekend thanks.

My page is working in the version of firefox I've got installed here, and I just checked for updates and it said there were none (running version 2.0.0.14).

Also I'm looking at putting some specific icons in e.g. the start, I noticed you changed the maps.js file to cope with this for someone else. Doesn't work for me unfortunately as my gpx file is trackpoints rather than waypoints. Is it possible for me to change the javascript in a similar way to display different icons for particular named trackpoints? I'm happy to have a go at doing it myself if I know it's possible

ebygomm

Posts: 39
Registered: 03/04/08
Re: Help with creating routes
Posted: 05-Jun-2008 22:28   in response to: ebygomm
  Click to reply to this thread Reply

Just noticed that they've got a preview of Firefox 3 point something running, so that'll be the one it's not working in.

Is the workaround likely to affect anything else and is it something that'll need to be removed in future?

I'm not too worried about catering for people testing this version of firefox or mac users :-) at this stage

rgphilpott

Posts: 146
Registered: 18/06/12
Re: Help with creating routes
Posted: 05-Jun-2008 22:33   in response to: ebygomm
  Click to reply to this thread Reply

1) The problem occurs with Firefox 3.0, which hasn't been formally released yet (but it's now at Release Candidate 2, so it will be out soon now, and a lot of us are already using it as our default browser).

2) I don't think GPX supports the naming of trackpoints. I think a better solution would be just to add a waypoint where you want the icon and then use the existing code.

Cheers,

Richard.

rgphilpott

Posts: 146
Registered: 18/06/12
Re: Help with creating routes
Posted: 07-Jun-2008 12:10   in response to: ebygomm
  Click to reply to this thread Reply

I see that you've had a go at this ...

Note that the extra lines need to be inside the init() function. The best place to put them would be immediately before line number 43 ("if (data)").

Richard.

ebygomm

Posts: 39
Registered: 03/04/08
Re: Help with creating routes
Posted: 07-Jun-2008 12:25   in response to: rgphilpott
  Click to reply to this thread Reply

> Note that the extra lines need to be inside
> the init() function. The best place to put them would
> be immediately before line number 43 ("if (data)").

That's what I thought, but putting it in there stopped the whole thing working so I was experimenting!

ebygomm

Posts: 39
Registered: 03/04/08
Re: Help with creating routes
Posted: 07-Jun-2008 12:38   in response to: rgphilpott
  Click to reply to this thread Reply

worked out the problem! Filename should read heading in this line <h2 id="pageheading">Filename</h2>
Message was edited by: ebygomm

rgphilpott

Posts: 146
Registered: 18/06/12
Re: Help with creating routes
Posted: 07-Jun-2008 12:57   in response to: ebygomm
  Click to reply to this thread Reply

What you have initially in the <h2> tag doesn't make any difference -- it's the id that must match what's in the javascript. In fact, it's probably best to leave it initially empty:

<h2 id="pageheading"></h2>

so that the initial value doesn't flash up briefly before being overwritten.

Working example here:

http://maps.rgp.me.uk/example/gpxexample.html?f=20080504.gpx

Cheers,

Richard.

ebygomm

Posts: 39
Registered: 03/04/08
Re: Help with creating routes
Posted: 07-Jun-2008 13:06   in response to: rgphilpott
  Click to reply to this thread Reply

Hmm, just coincidence that it worked when I changed it to that then.

Oh well, all sorted now, until the next issue I'm sure :-)

Will try and incorporate the workaround stuff in later on

rgphilpott

Posts: 146
Registered: 18/06/12
Re: Help with creating routes
Posted: 23-Jun-2008 17:41   in response to: rgphilpott
  Click to reply to this thread Reply

I have now updated the original example so that it now works correctly with multiple routes and/or tracks, even if they are not contiguous.

Examples:

http://maps.rgp.me.uk/example/gpxexample.html?f=TwoRoutes.gpx

http://maps.rgp.me.uk/example/gpxexample.html?f=WesterRoss2008.gpx


Richard Philpott.

nhopton

Posts: 9
Registered: 28/08/08
Re: Help with creating routes
Posted: 31-Aug-2008 12:08   in response to: rgphilpott
  Click to reply to this thread Reply

Thanks to the help that I've received by reading this thread it has been possible for me to arrive, after just a couple of hours, at the position where I can plot gpx files of walks that I have done. This has involved the wholesale theft of other peoples' work (especially Richard's) to whom I'm very grateful. My first effort is here:

http://confound.me.uk/walks/gpxexample.html?f=Hambledon.gpx

Having got this far so quickly and in complete ignorance of anything to do with Java, I wonder if it is possible for the waypoint markers to contain links to images which will be popped-up when the marker is clicked. Or am I expecting too much?

Regards,
Nick.

rgphilpott

Posts: 146
Registered: 18/06/12
Re: Help with creating routes
Posted: 01-Sep-2008 10:52   in response to: nhopton
  Click to reply to this thread Reply

Nick,

This is already handled with the javascript code that you are using now (not Java -- that's something quite different!).

If there is any content in the <cmt> or <desc> elements for a waypoint, this is used as HTML within a pop-up window displayed when you click on the marker. This HTML can include an <img> element to display an image within the pop-up. You may need to play around with the CSS styles a bit to get the size right.

How you populate the <cmt> or <desc> elements will depend on how you are creating your GPX -- for example, MemoryMap and Anquet put the waypoint "description" there.

If you do it by hand you'll need to put the HTML into a CDATA wrapper.

I'll try to do a quick demo of this later this week.

Cheers,

Richard.

nhopton

Posts: 9
Registered: 28/08/08
Re: Help with creating routes
Posted: 01-Sep-2008 16:31   in response to: rgphilpott
  Click to reply to this thread Reply

Thanks for this Richard. I can manage images in Google Earth (follow the link at http://confound.me.uk for an example, sorry for the scrappy web page and note the caveat) and I've tried converting this kml file to a gpx file, but none of the conversion utilities I've tried will handle the links to the images properly.

Regards,
Nick.

Legend
Expert: 51 - 1000 pts
Advanced: 31 - 50 pts
Intermediate: 16 - 30 pts
Novice: 5 - 15 pts
Newbie: 0 - 4 pts
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums