Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

WV-1143,1142: Coordinate display now lat/lon with degrees and minutes

Mike McGann0804e0f148d9
diff --git a/web/css/map-ol2.css b/web/css/map-ol2.css
index fb06f2cf6..426f7fa34 100644
--- a/web/css/map-ol2.css
+++ b/web/css/map-ol2.css
@@ -29,12 +29,12 @@ div.olControlMousePosition, div.olControlScaleLineCustom {
div.olControlMousePosition, div.olControlScaleLineCustomBottom, div.olControlScaleLineCustomTop {
color: #EEEEEE;
- text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
font-size: 0.9em;
font-weight: bold;
}
div.olControlScaleLineCustomBottom, div.olControlScaleLineCustomTop {
/*background-color:rgba(38,38,38,0.4);*/
+ text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
background-color: rgba(0, 0, 0, 0.5);
float: right;
text-align: right;
@@ -43,10 +43,14 @@ div.olControlScaleLineCustomBottom, div.olControlScaleLineCustomTop {
}
div.olControlMousePosition {
bottom: 95px;
- padding: 1px 8px;
+ white-space: pre;
+ font-family: ‘Lucida Console’, Monaco, monospace;
+ background-color: rgba(0, 0, 0, 0.5);
+ text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
+ padding: 5px;
}
div.olControlScaleLineCustom {
- bottom: 118px;
+ bottom: 125px;
}
.olControlScaleLineCustomBottom {
/*border: solid 2px black;*/
diff --git a/web/js/map/wv.map.ui.js b/web/js/map/wv.map.ui.js
index a060653f6..a879c20a5 100644
--- a/web/js/map/wv.map.ui.js
+++ b/web/js/map/wv.map.ui.js
@@ -503,15 +503,17 @@ wv.map.ui = wv.map.ui || function(models, config) {
}));
var coordinateControl = new OpenLayers.Control.MousePosition({
+ previous: null,
formatOutput: function(mouseXY) {
var mouseLonLat = mouseXY.transform(proj.crs, "EPSG:4326");
// FIXME: Change back to projection model after
// arctic has been backfilled
var crs = ( models.proj.change ) ? models.proj.change.crs
: models.proj.selected.crs;
- return mouseLonLat.lon.toFixed(3) + "°, " +
- mouseLonLat.lat.toFixed(3) + "° " +
+ var str = wv.util.formatDM(mouseLonLat.lat, "latitude") + ", " +
+ wv.util.formatDM(mouseLonLat.lon, "longitude") + " " +
crs;
+ return str;
}
});
controls.push(coordinateControl);
@@ -593,6 +595,8 @@ wv.map.ui = wv.map.ui || function(models, config) {
// Keep track of center point on projection switch
map.previousCenter = map.getCenter();
+ // "13D12.123'N, 123D12.123'W EPSG:1234"
+ $(coordinateControl.div).html(" ");
return map;
};
diff --git a/web/js/util/wv.util.js b/web/js/util/wv.util.js
index f81ff69f5..dd038899e 100644
--- a/web/js/util/wv.util.js
+++ b/web/js/util/wv.util.js
@@ -566,6 +566,25 @@ wv.util = (function(self) {
DOWN: 40
};
+ self.formatDM = function(value, type) {
+ var width, signs;
+ if ( type === "longitude" ) {
+ width = 3;
+ signs = "EW";
+ } else {
+ width = 2;
+ signs = "NS";
+ }
+ var sign = ( value >= 0 ) ? signs[0] : signs[1];
+ var totalMinutes = Math.abs(value * 60);
+ var degrees = Math.floor(totalMinutes / 60);
+ var minutes = totalMinutes - (degrees * 60);
+
+ var sdegrees = self.pad(degrees, width, " ");
+ var sminutes = self.pad(minutes.toFixed(3), 6, " ");
+ return sdegrees + "°" + sminutes + "'" + sign;
+ };
+
return self;
})(wv.util || {});