[Geomoose-users] Change Latitude and Longitude format

Johan Forsman Johan.Forsman at LA.GOV
Tue Nov 8 13:25:56 EST 2011


Yes, mine is similar but far more cumbersome. Initially the display kept changing position horizontally depending on the coordinate values and to avoid that I added some padding with leading zeroes and E/W/N/S designations. Now it (mostly) stays put.


From: Ed Boesenberg [mailto:eboesenberg at niraengineers.com]
Sent: Tuesday, November 08, 2011 12:14 PM
To: Johan Forsman; 'Brent Fraser'
Cc: geomoose-users at lists.osgeo.org
Subject: RE: [Geomoose-users] Change Latitude and Longitude format

Here is my hack.  The code below was inserted into the displayCoordinates function somewhere near line 1909.

lat_d = degrees.y;
lat_m = (lat_d - Math.floor(lat_d)) * 60;
lat_s = (lat_m - Math.floor(lat_m)) * 60;

lon_d = Math.abs(degrees.x);
lon_m = (lon_d - Math.floor(lon_d)) * 60;
lon_s = (lon_m - Math.floor(lon_m)) * 60;

The code below was inserted somewhere near line 1926:

html += Math.round(lat_d) + "\u00B0" + '  ' + Math.round(lat_m) + "'" + '  ' + lat_s.toFixed(4) + "''" + ', ' + Math.round(lon_d) + "\u00B0" + '  ' + Math.round(lon_m) + "''" + '  ' + lon_s.toFixed(4) + "''";

Johan,

Did you have something similar?

Ed


From: Johan Forsman [mailto:Johan.Forsman at LA.GOV]<mailto:[mailto:Johan.Forsman at LA.GOV]>
Sent: Tuesday, November 08, 2011 12:36 PM
To: Brent Fraser; Ed Boesenberg
Cc: geomoose-users at lists.osgeo.org<mailto:geomoose-users at lists.osgeo.org>
Subject: RE: [Geomoose-users] Change Latitude and Longitude format

Ed/Brent:

Some time back I had a similar need to have simultaneous display of DMS and DD with fixed decimal places. My OpenLayers was 2.8 at the time (it still is), but I discovered that version 2.10 supposedly had an in-built "getFormattedlonlat" function that could do what I needed. I shamelessly adapted that function from the OpenLayers source and inserted it with several modification into compiled.js and it worked fine. The attached screenshot shows how it looks.

You may be able to directly use the function if you have a more current OpenLayers version than I do, otherwise I can share my extraordinarily inelegant hack.

Take care,
Johan.

From: geomoose-users-bounces at lists.osgeo.org<mailto:geomoose-users-bounces at lists.osgeo.org> [mailto:geomoose-users-bounces at lists.osgeo.org]<mailto:[mailto:geomoose-users-bounces at lists.osgeo.org]> On Behalf Of Brent Fraser
Sent: Tuesday, November 08, 2011 9:58 AM
To: Ed Boesenberg
Cc: geomoose-users at lists.osgeo.org<mailto:geomoose-users at lists.osgeo.org>
Subject: Re: [Geomoose-users] Change Latitude and Longitude format

Ed,

  Have a look at the displayCoordinates function in main.js.

Once we get  our issue tracker running, I'll add this as a requested feature.  In the mean time you may need to hack the function yourself.

Best Regards,

Brent Fraser

On 11/4/2011 7:49 AM, Ed Boesenberg wrote:
I would like to format the latitude and longitude output at the bottom of the map to DD MM SS.SSS.  The current format is DD.DDD.  What function do I need to modify?

Thanks,

Ed Boesenberg


_______________________________________________

Geomoose-users mailing list

Geomoose-users at lists.osgeo.org<mailto:Geomoose-users at lists.osgeo.org>

http://lists.osgeo.org/mailman/listinfo/geomoose-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/geomoose-users/attachments/20111108/80e40b9e/attachment-0001.html


More information about the Geomoose-users mailing list