Yet Another Cycling Forum
General Category => The Knowledge => GPS => Topic started by: arvid 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 (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 (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?
-
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.
-
Its pretty easy to do this with OpenLayers. See OpenLayers - OpenStreetMap Wiki (http://wiki.openstreetmap.org/wiki/OpenLayers)
There's a simple example for a GPS track overlay here: Openlayers Track example - OpenStreetMap Wiki (http://wiki.openstreetmap.org/wiki/Openlayers_Track_example)
You can just copy the code to your own website, then modify it to point to the correct GPX file and coordinates.
-
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 (http://arvid.org/tracks/100metric2011.html) and I call that progress.
-
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 (http://code.google.com/apis/maps/documentation/javascript/v2/)
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.
-
I already used gpsvisualizer.com to create this
http://arvid.org/tracks/metric100challenge2011.html (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 (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 (http://atlas.gpsvisualizer.com/map?url=http%3A//arvid.org/tracks/20090328brevet.kmz&bg=osm&c=50.849349,6.080225&z=10)
-
Why, you've done the heavy lifting for us. Nice. :thumbsup:
-
I already used gpsvisualizer.com to create this
http://arvid.org/tracks/metric100challenge2011.html (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 (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.
-
(http://www.aukadia.net/pix/vizmap.jpg)
I love it! :thumbsup:
-
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.
-
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 (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 (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
-
I already used gpsvisualizer.com to create this
http://arvid.org/tracks/metric100challenge2011.html (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 (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 (http://www.mseries.plus.com/ValeOfYork200-151010v3.html)
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