[OpenLayers-Dev] Formatting degrees in MousePosition
Jeff Dege
jdege at korterra.com
Mon Jan 29 11:34:19 EST 2007
I think that offering an option of displaying degrees in minutes and
seconds, instead of decimal fraction, is a useful addition.
But I don't think it's reasonable to assume that anyone who is using
degree coordinates wants to display minutes and seconds. Some of us
want to display lon/lat in decimal degrees.
> -----Original Message-----
> From: dev-bounces at openlayers.org
> [mailto:dev-bounces at openlayers.org] On Behalf Of Lance Dyas
> Sent: Monday, January 29, 2007 8:30 AM
> To: dev at openlayers.org
> Subject: [OpenLayers-Dev] Formatting degrees in MousePosition
>
> Fairly simple code... makes it more glossy/finished seeming.
>
>
> formatCoords: function (base) {
> var t, t2;
> var degrees = Math.floor(base);
> var minutes = Math.floor(t = ( base - degrees ) * 60);
> var seconds = Math.floor(t2 = ( t - minutes ) * 6000);
> seconds = seconds / 100.00;
> return ("" + degrees + "\u00B0 " + minutes + "\u0027 " +
> seconds + "\u0022" );
>
> AND
>
> if (this.map.units == "degrees") {
> newHtml = this.formatCoords(lonLat.lon) +
> this.separator +
> this.formatCoords(lonLat.lat);
> }
> else {
> var digits = parseInt(this.numdigits);
> newHtml =
> this.prefix +
> lonLat.lon.toFixed(digits) +
> this.separator +
> lonLat.lat.toFixed(digits) +
> this.suffix;
> }
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev
>
More information about the Dev
mailing list