[OpenLayers-Users] Formatting output text
Joel Leininger
leiningr at gmail.com
Tue Aug 16 13:21:29 EDT 2011
How do I go about reformatting the text output from a coordinate
variable?
In other words, I have output from a mouse position which has been
transformed into different coordinate systems, and then gets displayed
on the screen.
It now looks something like this:
lon=414614.58552010887,lat=164066.82345258445
In reality, the values are x and y coords in feet or meters, not lonlat
coords. I'd like them to look like this:
N 164066, E 414614
Note the truncation of the digits and switching of the x, y (which is
customary in my field). Not being a JS expert, I can't figure out how to
get at the variable to massage the format prior to display on the
screen.
Here's the code leading up to the display (inside of a mousemove
function):
mousepos = map.getLonLatFromViewPortPx(e);
var NAD83ft_values = mousepos.clone(); // done several times for
different coord translations
NAD83ft_values.transform(WGS84_google_mercator, NAD83ft_proj);
document.getElementById("NAD83feet").innerHTML = NAD83ft_values;
It's unpacking NAD83ft_values that has me thrown. Any help?
-J.
More information about the Users
mailing list