Author Topic: Publishing tracklogs with OSM as background?  (Read 2291 times)

Publishing tracklogs with OSM as background?
« on: 30 January, 2011, 03:14:39 pm »
I would like to publish tracklogs on a website, with OSM as background. With Google Maps this is possible, like this:
http://maps.google.com/maps?f=q&q=http:%2F%2Farvid.org%2Ftracks%2F20090328brevet.kmz
Now I would like to do the same, or something comparable, with OSM.
I already used gpsvisualizer.com to create this
http://arvid.org/tracks/metric100challenge2011.html
But I needed a Google Maps API-code to publish that on my own domain. That's a bit ironic, since I'm trying to get Google out of it.
Does the crowd have an idea whether it is possible to do what I want?
Forgive me Father, for I have sinned. It has been too many days since I have ridden through the night with a brevet card in my pocket...

frankly frankie

  • I kid you not
    • Fuchsiaphile
Re: Publishing tracklogs with OSM as background?
« Reply #1 on: 30 January, 2011, 04:02:57 pm »
OSM have an API that is similar enough to the Google Maps one that, AIUI, all you have to do is substitute one API key for the other, and otherwise use the same Javascript.  (I haven't tried it yet - keep meaning to.)

Though Gmaps no longer requires an API key BTW, you can embed Google maps on any website without it.
when you're dead you're done, so let the good times roll

fuaran

  • rothair gasta
Re: Publishing tracklogs with OSM as background?
« Reply #2 on: 30 January, 2011, 06:59:11 pm »
Its pretty easy to do this with OpenLayers. See OpenLayers - OpenStreetMap Wiki
There's a simple example for a GPS track overlay here: Openlayers Track example - OpenStreetMap Wiki

You can just copy the code to your own website, then modify it to point to the correct GPX file and coordinates.

Re: Publishing tracklogs with OSM as background?
« Reply #3 on: 30 January, 2011, 09:14:20 pm »
frankie: I got asked for the API though.

fuaran: That's what I was looking for, thank you. Far more flexible than gmaps of course, so more to configure. But I managed this now:
http://arvid.org/tracks/100metric2011.html and I call that progress.
Forgive me Father, for I have sinned. It has been too many days since I have ridden through the night with a brevet card in my pocket...

frankly frankie

  • I kid you not
    • Fuchsiaphile
Re: Publishing tracklogs with OSM as background?
« Reply #4 on: 31 January, 2011, 12:10:17 pm »
Off-topic but re Gmaps API key -
the current API is v3, and doesn't require a key.
API v2 is deprecated (as of last May), and is the one that uses the key.  It still works of course, and 90% of the useful code snippets out there are written in v2 - but at some point maybe years down the line, v2 code will stop working.
Google Maps v2 API

Quite apart from the key thing, v3 code is to my mind slightly more comprehensible (that is, it takes half an hour to turn my brain inside out, instead of just 20 minutes) - so I'd recommend anyone who has Gmaps stuff on a website to grasp the nettle and migrate the code to the new format.  Many, but not all, of the alterations are a simple global search-and-replace.  One or 2 things that existed in v2 have been lost - but OTOH v3 has its own slew of shiny new stuff.
when you're dead you're done, so let the good times roll

gpsvisualizer

Re: Publishing tracklogs with OSM as background?
« Reply #5 on: 01 February, 2011, 06:23:31 am »
I already used gpsvisualizer.com to create this
http://arvid.org/tracks/metric100challenge2011.html
But I needed a Google Maps API-code to publish that on my own domain.
Try using GPS Visualizer's relatively new "Atlas" feature: http://www.gpsvisualizer.com/atlas.html -- it doesn't require a key, just a GPS data file that lives online somewhere.

For example: http://atlas.gpsvisualizer.com/map?url=http%3A//arvid.org/tracks/20090328brevet.kmz&bg=osm&c=50.849349,6.080225&z=10

andygates

  • Peroxide Viking
Re: Publishing tracklogs with OSM as background?
« Reply #6 on: 01 February, 2011, 09:25:57 am »
Why, you've done the heavy lifting for us.  Nice.  :thumbsup:
It takes blood and guts to be this cool but I'm still just a cliché.
OpenStreetMap UK & IRL Streetmap & Topo: ravenfamily.org/andyg/maps updates weekly.

Re: Publishing tracklogs with OSM as background?
« Reply #7 on: 01 February, 2011, 10:03:29 am »
I already used gpsvisualizer.com to create this
http://arvid.org/tracks/metric100challenge2011.html
But I needed a Google Maps API-code to publish that on my own domain.
Try using GPS Visualizer's relatively new "Atlas" feature: http://www.gpsvisualizer.com/atlas.html -- it doesn't require a key, just a GPS data file that lives online somewhere.

That's a bit closer to what I wanted, but still not completely. Earlier I fed my tracklogs to gpsvisualizer to create a kmz-file, and then showed it on Google Maps. Although Google Maps has its quirks, that's only part of the reason I want to do it differently.
I can't use my scrollwheel to zoom in your Atlas interface. It still uses Google (and I don't want to), and I need you as well. As audaxer that's just taking too much of my self-sufficiency away.
Forgive me Father, for I have sinned. It has been too many days since I have ridden through the night with a brevet card in my pocket...

frankly frankie

  • I kid you not
    • Fuchsiaphile
Re: Publishing tracklogs with OSM as background?
« Reply #8 on: 01 February, 2011, 10:29:47 am »



I love it!   :thumbsup:
when you're dead you're done, so let the good times roll

gpsvisualizer

Re: Publishing tracklogs with OSM as background?
« Reply #9 on: 02 February, 2011, 09:03:44 pm »
I've edited the Atlas template so that mouse-wheel scrolling works now.

Note, though, that it doesn't zoom in on the place where your mouse cursor is; it zooms based on the center of the map, the same as if you'd clicked the plus/minus icons on the zoom control.

Re: Publishing tracklogs with OSM as background?
« Reply #10 on: 02 February, 2011, 09:18:17 pm »
I would like to publish tracklogs on a website, with OSM as background. With Google Maps this is possible, like this:
http://maps.google.com/maps?f=q&q=http:%2F%2Farvid.org%2Ftracks%2F20090328brevet.kmz
Now I would like to do the same, or something comparable, with OSM.
I already used gpsvisualizer.com to create this
http://arvid.org/tracks/metric100challenge2011.html
But I needed a Google Maps API-code to publish that on my own domain. That's a bit ironic, since I'm trying to get Google out of it.
Does the crowd have an idea whether it is possible to do what I want?

Google Maps API v3 doesn't need a key

Re: Publishing tracklogs with OSM as background?
« Reply #11 on: 02 February, 2011, 09:27:02 pm »
I already used gpsvisualizer.com to create this
http://arvid.org/tracks/metric100challenge2011.html
But I needed a Google Maps API-code to publish that on my own domain.
Try using GPS Visualizer's relatively new "Atlas" feature: http://www.gpsvisualizer.com/atlas.html -- it doesn't require a key, just a GPS data file that lives online somewhere.

That's a bit closer to what I wanted, but still not completely. Earlier I fed my tracklogs to gpsvisualizer to create a kmz-file, and then showed it on Google Maps. Although Google Maps has its quirks, that's only part of the reason I want to do it differently.
I can't use my scrollwheel to zoom in your Atlas interface. It still uses Google (and I don't want to), and I need you as well. As audaxer that's just taking too much of my self-sufficiency away.


If you want some code that you can run with your gpx track as input that will generate a page that you can host let me know. SOmething like this

 by MSeries

I have the code, just need to whip it into something that you could use or I could host it somewhere. Not OSM though but also no Google key. It's a html page with some javascript to draw the track. It was generated from a template and a gpx