Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Web Mercator support

Mike McGannfb402d697ac1
diff --git a/bin/fetch-gibs b/bin/fetch-gibs
index 3b19d6d41..37cdddb80 100755
--- a/bin/fetch-gibs
+++ b/bin/fetch-gibs
@@ -23,6 +23,8 @@ curl -s -o $DESTDIR/gibs-arctic.xml \
"$GIBS_URL"/wmts-arctic/wmts.cgi?request=GetCapabilities
curl -s -o $DESTDIR/gibs-antarctic.xml \
"$GIBS_URL"/wmts-antarctic/wmts.cgi?request=GetCapabilities
+curl -s -o $DESTDIR/gibs-webmerc.xml \
+ "$GIBS_URL"/wmts-webmerc/wmts.cgi?request=GetCapabilities
diff --git a/bin/gibs2wv b/bin/gibs2wv
index 6ed38e001..cdf91a31c 100755
--- a/bin/gibs2wv
+++ b/bin/gibs2wv
@@ -57,7 +57,6 @@ for filename in args:
wv_layer["id"] = id
wv_layer["type"] = "wmts"
- wv_layer["tileSize"] = [512, 512]
wv_layer["format"] = gc_layer["Format"]
# Extract start and end dates
@@ -97,6 +96,11 @@ for filename in args:
"source": "GIBS:antarctic",
"matrixSet": "GIBS:" + matrixSet
}
+ if matrixSet.startswith("GoogleMaps"):
+ wv_layer["projections"]["webmerc"] = {
+ "source": "GIBS:webmerc",
+ "matrixSet": matrixSet
+ }
json_options = {}
json_options["indent"] = 4
diff --git a/conf/web/main/matrixSets/GoogleMaps.json b/conf/web/main/matrixSets/GoogleMaps.json
new file mode 100644
index 000000000..6969426b1
--- /dev/null
+++ b/conf/web/main/matrixSets/GoogleMaps.json
@@ -0,0 +1,62 @@
+{
+ "matrixSets": {
+ "GoogleMapsCompatible_Level9": {
+ "id": "GoogleMapsCompatible_Level9",
+ "maxResolution": 156543.03390625,
+ "serverResolutions": [
+ 156543.03390625,
+ 78271.516953125,
+ 39135.7584765625,
+ 19567.8792382812,
+ 9783.9396191406,
+ 4891.9698095703,
+ 2445.9849047851,
+ 1222.9924523925,
+ 611.4962261962
+ ],
+ "tileSize": [256, 256]
+ },
+ "GoogleMapsCompatible_Level8": {
+ "id": "GoogleMapsCompatible_Level8",
+ "maxResolution": 156543.03390625,
+ "serverResolutions": [
+ 156543.03390625,
+ 78271.516953125,
+ 39135.7584765625,
+ 19567.8792382812,
+ 9783.9396191406,
+ 4891.9698095703,
+ 2445.9849047851,
+ 1222.9924523925
+ ],
+ "tileSize": [256, 256]
+ },
+ "GoogleMapsCompatible_Level7": {
+ "id": "GoogleMapsCompatible_Level7",
+ "maxResolution": 156543.03390625,
+ "serverResolutions": [
+ 156543.03390625,
+ 78271.516953125,
+ 39135.7584765625,
+ 19567.8792382812,
+ 9783.9396191406,
+ 4891.9698095703,
+ 2445.9849047851
+ ],
+ "tileSize": [256, 256]
+ },
+ "GoogleMapsCompatible_Level6": {
+ "id": "GoogleMapsCompatible_Level6",
+ "maxResolution": 156543.03390625,
+ "serverResolutions": [
+ 156543.03390625,
+ 78271.516953125,
+ 39135.7584765625,
+ 19567.8792382812,
+ 9783.9396191406,
+ 4891.9698095703
+ ],
+ "tileSize": [256, 256]
+ }
+ }
+}
diff --git a/conf/web/main/matrixSets/gibs/1km.json b/conf/web/main/matrixSets/gibs/1km.json
index c524fcfdc..d7cce3f77 100644
--- a/conf/web/main/matrixSets/gibs/1km.json
+++ b/conf/web/main/matrixSets/gibs/1km.json
@@ -8,7 +8,8 @@
4096.0,
2048.0,
1024.0
- ]
+ ],
+ "tileSize": [512, 512]
},
"GIBS:EPSG3413_1km": {
"id": "EPSG3413_1km",
@@ -18,7 +19,8 @@
4096.0,
2048.0,
1024.0
- ]
+ ],
+ "tileSize": [512, 512]
},
"GIBS:EPSG4326_1km": {
"id": "EPSG4326_1km",
@@ -31,7 +33,8 @@
0.03515625,
0.017578125,
0.0087890625
- ]
+ ],
+ "tileSize": [512, 512]
}
}
}
\ No newline at end of file
diff --git a/conf/web/main/matrixSets/gibs/250m.json b/conf/web/main/matrixSets/gibs/250m.json
index c9d455e43..44b281dc2 100644
--- a/conf/web/main/matrixSets/gibs/250m.json
+++ b/conf/web/main/matrixSets/gibs/250m.json
@@ -10,7 +10,8 @@
1024.0,
512.0,
256.0
- ]
+ ],
+ "tileSize": [512, 512]
},
"GIBS:EPSG3413_250m": {
"id": "EPSG3413_250m",
@@ -22,7 +23,8 @@
1024.0,
512.0,
256.0
- ]
+ ],
+ "tileSize": [512, 512]
},
"GIBS:EPSG4326_250m": {
"id": "EPSG4326_250m",
@@ -37,7 +39,8 @@
0.0087890625,
0.00439453125,
0.002197265625
- ]
+ ],
+ "tileSize": [512, 512]
}
}
}
\ No newline at end of file
diff --git a/conf/web/main/matrixSets/gibs/2km.json b/conf/web/main/matrixSets/gibs/2km.json
index d5a0a250d..5c216473a 100644
--- a/conf/web/main/matrixSets/gibs/2km.json
+++ b/conf/web/main/matrixSets/gibs/2km.json
@@ -10,7 +10,8 @@
0.0703125,
0.03515625,
0.017578125
- ]
+ ],
+ "tileSize": [512, 512]
}
}
}
\ No newline at end of file
diff --git a/conf/web/main/matrixSets/gibs/500m.json b/conf/web/main/matrixSets/gibs/500m.json
index 277bac605..96826aa62 100644
--- a/conf/web/main/matrixSets/gibs/500m.json
+++ b/conf/web/main/matrixSets/gibs/500m.json
@@ -9,7 +9,8 @@
2048.0,
1024.0,
512.0
- ]
+ ],
+ "tileSize": [512, 512]
},
"GIBS:EPSG3413_500m": {
"id": "EPSG3413_500m",
@@ -20,7 +21,8 @@
2048.0,
1024.0,
512.0
- ]
+ ],
+ "tileSize": [512, 512]
},
"GIBS:EPSG4326_500m": {
"id": "EPSG4326_500m",
@@ -34,7 +36,8 @@
0.017578125,
0.0087890625,
0.00439453125
- ]
+ ],
+ "tileSize": [512, 512]
}
}
}
\ No newline at end of file
diff --git a/conf/web/main/projections/webmerc.json b/conf/web/main/projections/webmerc.json
new file mode 100644
index 000000000..a27a37e2c
--- /dev/null
+++ b/conf/web/main/projections/webmerc.json
@@ -0,0 +1,33 @@
+{
+ "projections": {
+ "webmerc": {
+ "id": "webmerc",
+ "epsg": 3857,
+ "crs": "EPSG:3857",
+ "proj4": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs",
+ "maxExtent": [
+ -20037508.34,
+ -20037508.34,
+ 20037508.34,
+ 20037508.34
+ ],
+ "resolutions": [
+ 156543.03390625,
+ 78271.516953125,
+ 39135.7584765625,
+ 19567.8792382812,
+ 9783.9396191406,
+ 4891.9698095703,
+ 2445.9849047851,
+ 1222.9924523925,
+ 611.4962261962
+ ],
+ "numZoomLevels": 9,
+ "startCenter": [
+ 0,
+ 0
+ ],
+ "startZoom": 3
+ }
+ }
+}
diff --git a/conf/web/main/sources.json b/conf/web/main/sources.json
index 8305e80b5..fb58e78fb 100644
--- a/conf/web/main/sources.json
+++ b/conf/web/main/sources.json
@@ -21,6 +21,13 @@
"//@[email protected]/wmts-geo/wmts.cgi"
]
},
+ "GIBS:webmerc": {
+ "url": [
+ "//@[email protected]/wmts-webmerc/wmts.cgi",
+ "//@[email protected]/wmts-webmerc/wmts.cgi",
+ "//@[email protected]/wmts-webmerc/wmts.cgi"
+ ]
+ },
"GIBS:wms": {
"url": [
"//map2a.vis.earthdata.nasa.gov/wms/wms.php",
diff --git a/src/js/map/wv.map.js b/src/js/map/wv.map.js
index 0fcb9babf..90d51fd39 100644
--- a/src/js/map/wv.map.js
+++ b/src/js/map/wv.map.js
@@ -56,6 +56,13 @@ wv.map = (function(self) {
Math.round(mouseLonLat.lon) + "m, " +
Math.round(mouseLonLat.lat) + "m";
},
+ }),
+ "webmerc": new OpenLayers.Control.MousePosition({
+ formatOutput: function(mouseXY) {
+ var mouseLonLat = mouseXY.transform("EPSG:3857", "EPSG:4326");
+ return mouseLonLat.lon.toFixed(3) + "°, " +
+ mouseLonLat.lat.toFixed(3) + "°";
+ }
})
};
diff --git a/src/js/map/wv.map.layers.js b/src/js/map/wv.map.layers.js
index 4a51fdea5..1b9f47f2a 100644
--- a/src/js/map/wv.map.layers.js
+++ b/src/js/map/wv.map.layers.js
@@ -37,8 +37,8 @@ wv.map.layers.set = function(config, projId, layerId) {
maxResolution: matrixSet.maxResolution,
serverResolutions: matrixSet.serverResolutions,
maxExtent: proj.maxExtent,
- tileSize: new OpenLayers.Size(layer.tileSize[0],
- layer.tileSize[1]),
+ tileSize: new OpenLayers.Size(matrixSet.tileSize[0],
+ matrixSet.tileSize[1]),
visibility: false
};
if ( layer.noTransition ) {
@@ -74,8 +74,7 @@ wv.map.layers.set = function(config, projId, layerId) {
params.time = add.time;
}
var options = {
- tileSize: new OpenLayers.Size(layer.tileSize[0],
- layer.tileSize[1]),
+ tileSize: new OpenLayers.Size(512, 512),
visiblity: false
};
if ( layer.opacity ) {
diff --git a/src/js/map/wv.map.model.js b/src/js/map/wv.map.model.js
index e4b682011..dbc347de2 100644
--- a/src/js/map/wv.map.model.js
+++ b/src/js/map/wv.map.model.js
@@ -81,7 +81,7 @@ wv.map.model = wv.map.model || function(models, config) {
self.setExtentToLeading = function() {
// Polar projections don't need to be positioned
- if ( self.maps.projection !== "geographic" ) {
+ if ( self.maps.projection !== "geographic" || self.maps.projection !== "webmerc" ) {
return;
}
@@ -111,7 +111,12 @@ wv.map.model = wv.map.model || function(models, config) {
var lon = minLon + (Math.abs(maxLon - minLon) / 2.0);
var zoomLevel = 2;
- map.setCenter(new OpenLayers.LonLat(lon, lat), zoomLevel);
+ var center = new OpenLayers.LonLat(lon, lat);
+ if ( self.maps.projection === "webmerc" ) {
+ center = center.transform("EPSG:4326", "EPSG:3857");
+ zoomLevel = 3;
+ }
+ map.setCenter(center, zoomLevel);
};
var onProjectionSelect = function() {
diff --git a/src/js/proj/wv.proj.ui.js b/src/js/proj/wv.proj.ui.js
index ece0fabb0..ecbf2b60c 100644
--- a/src/js/proj/wv.proj.ui.js
+++ b/src/js/proj/wv.proj.ui.js
@@ -34,6 +34,10 @@ wv.proj.ui = wv.proj.ui || function(models) {
antarctic: {
highlighted: "images/antarcticon.png",
normal: "images/antarctic.png"
+ },
+ webmerc: {
+ highlighted: "images/geographicon.png",
+ normal: "images/geographic.png"
}
};
var model = models.proj;