I'd like to place a simple map on a page, and the cursor location should be shown. I can do this but the location is shown in meters instead of degrees. How can I change the units to degrees?
Edit. Here's a screenshot clip of the map from the code above shown in Firefox: asked 13 Jan '14, 21:09 gibbousmoon |
This isn't a question for openstreetmap - it's purely an openlayers question. You'd be better asking on the openlayers mailing lists or on gis.stackexchange.com In saying that, I know the answer since I've done this in the past :-) You need to set the projection of your map, and the displayProjection too. Controls like permalink and mouseposition use the displayProjection but often go wrong if the map projection isn't set too. Try something like:
(taken from the OpenCycleMap source code) answered 14 Jan '14, 17:32 Andy Allan 2
Thank you so much for the answer! :) Problem solved. My apologies for posting this question here. To be honest, I didn't quite see how close this thing called OpenLayers is related to OSM.
(15 Jan '14, 10:23)
gibbousmoon
|
The position is shown in degrees and not meters. Perhaps you want degrees.minutes.seconds or some other format instead of decimal degrees ? Which one ? Sorry there doesn't seem to be an option to change the unit displayed in mouseposition. You could try patching mouseposition.js to get your prefered format. answered 14 Jan '14, 09:30 Vincent de P... ♦ 1
That said, non-decimal lat/long formats really should be forgoten about. Many people are used to them, but they are just pointlessly complicated, inherited from the time when a sextan was the best way to measure your location. Decimal degrees are better. Decimal degrees (decimal units in general) really should be the only kind you use. Consider changing all your tools (including your brain) to decimal instead of the other way around.
(14 Jan '14, 09:36)
Vincent de P... ♦
Thanks for your answer but it's not at all about deg:min:sec vs. decimal degs. I had a many hours battle with OpenLayers but still cannot figure out how to change the units. The units are lying somewhere in class map or layer or projection. There must be a simple solution to this problem. I hope this a relevant question in this help center.
(14 Jan '14, 13:03)
gibbousmoon
|