Biểu trưng OpenStreetMap OpenStreetMap

Show track on OSM map

Do p-h đăng vào 11 tháng 12 năm 2011 bằng English.

If you want to see a track (which is uploaded on OSM) on an OSM background, just call:
http://www.emplexity.eu/osm_track_on_map.php/?id=xxxxxxx by replacing xxxxxxx with the OSM id of the track you want to visualize.

You may want to have a glimpse of what it looks like at www.emplexity.eu and click on the OSM icons attached to the cycle rides.

I felt the need to develop this php/javascript/openlayers script from bits and pieces I found around on the internet as I have not found such a ready made function on the web.

Hope you will find this useful.

Biểu tượng thư điện tử Biểu tượng Bluesky Biểu tượng Facebook Biểu tượng LinkedIn Biểu tượng Mastodon Biểu tượng Telegram Biểu tượng X

Thảo luận

Bình luận của p-h vào 14 tháng 12 năm 2011 lúc 20:30

a bit but with a bit more. differences are:
1. track shown fully on screen and centered, with continuous semi transparent line;
2. callable directly by URL so that you can embed it in a page or type in the URL bar of the browser. The osm.org link that you suggest above requires keying in the id on screen and I do not see how to embedded it.
Got most inspiration for the js code from osm.wiki/User:MHohmann#Application:_GPX_layers_with_popups_in_OpenLayers. But there is as well some PHP needed to access the track on OSM, get its bounds and center and pass it the js script and openlayer.

Bình luận của joost schouppe vào 21 tháng 3 năm 2014 lúc 09:32

Pretty cool, except that http://www.emplexity.eu/osm_track_on_map.php/?id=1667511 doens’t visualize osm.org/user/joost%20schouppe/traces/1667511 . So I must be doing it wrong.

Bình luận của p-h vào 22 tháng 3 năm 2014 lúc 15:18

to Joost: Indeed, since OSM changed its export trace format to bz2 (1st Qtr 2013), and as I’ve not succeeded to uncode the OSM bz2 file with php, I switched the source of the supported traces from OSM to Garmin Connect. The id parameter which is now supported by this service is the activity number in Garmin connect. If someone can point me to how to uncode bz2 file in php, I would be happy to support OSM trace file again.

Đăng nhập để nhận xét