Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Hacked a fix for image download resize bug: - if browser is resized while in image download mode, the resulting image if of a different area than the one selected

Tilak Joshiacba3e1a13e2
diff --git a/index.html b/index.html
index 73140265f..fd3fc6fe6 100644
--- a/index.html
+++ b/index.html
@@ -44,13 +44,13 @@
<!-- CSS for map style -->
- <link type="text/css" href="css/map-min.css?v=0.3.0" rel="Stylesheet" />
- <link type="text/css" href="css/dateSpan-min.css?v=0.3.0" rel="Stylesheet" />
+ <link type="text/css" href="css/map.css?v=0.3.0" rel="Stylesheet" />
+ <link type="text/css" href="css/dateSpan.css?v=0.3.0" rel="Stylesheet" />
<link type="text/css" href="css/menuPicker-min.css?v=0.3.0" rel="Stylesheet" />
<link type="text/css" href="css/accordionPicker-min.css?v=0.3.0" rel="Stylesheet" />
- <link type="text/css" href="css/bank-min.css?v=0.3.0" rel="Stylesheet" />
- <link type="text/css" href="css/selector-min.css?v=0.3.0" rel="Stylesheet" />
- <link type="text/css" href="css/sote-min.css?v=0.3.0" rel="Stylesheet" />
+ <link type="text/css" href="css/bank.css?v=0.3.0" rel="Stylesheet" />
+ <link type="text/css" href="css/selector.css?v=0.3.0" rel="Stylesheet" />
+ <link type="text/css" href="css/sote.css?v=0.3.0" rel="Stylesheet" />
<link type="text/css" href="css/ext/jcrop/jcrop.css" rel="Stylesheet" />
<!-- External Javascript includes -->
@@ -82,7 +82,6 @@
<div id="banner"><img class='logo' src='images/logo.png' />
<ul>
<li><a id='aboutus_link' class='toolbaricon' href='javascript:showOverlay();'><img src='images/information.png' /></a></li>
- <!--<li><a id='camera_link' class='toolbaricon' href='javascript:showRubberBand();'><img src='images/camera.png' /></a></li>-->
<li><div id='camera'></div></li>
<li><div id="switch"></div></li>
<li><a id='perma_link' class='toolbaricon' href='javascript:showPermalink();'><img src='images/permalink.png' /></a></li>
diff --git a/js/imageDownload.js b/js/imageDownload.js
index 55f28bc6b..e9d80f3fe 100644
--- a/js/imageDownload.js
+++ b/js/imageDownload.js
@@ -37,7 +37,7 @@ SOTE.widget.ImageDownload = function(containerId, config){
this.alignTo = config.alignTo;
this.id = containerId;
- this.map = null;
+ this.map = config.m.map;
this.WMTSLayer = null;
if (config.baselayer === undefined)
@@ -77,43 +77,6 @@ SOTE.widget.ImageDownload.prototype.init = function(){
}
this.projectionSwitch = "geographic";
- this.map = new OpenLayers.Map({
- div: "dlMap",
- theme: null,
- controls: [],
- maxExtent: new OpenLayers.Bounds(-180,-90,180,90),
- projection:"EPSG:4326",
- numZoomLevels:9,
- fractionalZoom: false,
- resolutions: this.RESOLUTIONS_ON_SCREEN_GEO_ALL,
- allOverlays: false,
- zoom: 2
- });
-
-
-
- this.WMTSLayer = new OpenLayers.Layer.WMTS(
- {
- name: "dl",
- url: "",
- layer: "ImageDownload",
- matrixSet: "EPSG4326_250m",
- projection: "EPSG:4326",
- serverResolutions: this.RESOLUTIONS_ON_SERVER_GEO_250m,
- visibility: false,
- 'tileSize': new OpenLayers.Size(512, 512),
- maxExtent: new OpenLayers.Bounds(-180,-90,180,90),
- style: "_null",
- visibility: false,
- isBaseLayer: true
- }
-
- );
-
- this.map.addLayer(this.WMTSLayer);
-
- this.WMTSLayer.setVisibility(false);
-
var htmlElements = "<div>Resolution:<select id='selImgResolution'><option value='1'>250m</option><option value='2'>500m</option><option value='4'>1km</option><option value='20'>5km</option><option value='40'>10km</option></select>";
htmlElements +="<br />Format: <select id='selImgFormat'><option value='JPEG'>JPEG</option><option value='PNG'>PNG</option><option value='Gtiff'>GeoTIFF</option></select>";
@@ -176,9 +139,7 @@ SOTE.widget.ImageDownload.prototype.updateComponent = function(qs){
var px = pixels.split(",");
var x1 = px[0]; var y1= px[1]; var x2 = px[2]; var y2=px[3];
- this.map.zoomToExtent(new OpenLayers.Bounds.fromString(bbox));
-
- var currExtent = this.map.getExtent();
+
var lonlat1 = this.map.getLonLatFromViewPortPx(new OpenLayers.Pixel(x1, y2));
var lonlat2 = this.map.getLonLatFromViewPortPx(new OpenLayers.Pixel(x2, y1));
diff --git a/js/sote.js b/js/sote.js
index 8636b51cd..1b9bcc1ac 100644
--- a/js/sote.js
+++ b/js/sote.js
@@ -36,7 +36,7 @@ window.onload = function(){// Initialize "static" vars
var map = new SOTE.widget.DateSpan("time",{hasThumbnail:false});
//Image download variables
rb = new SOTE.widget.RubberBand("camera",{icon:"images/camera.png",onicon:"images/cameraon.png",cropee:"map"});
- var id = new SOTE.widget.ImageDownload("imagedownload",{baseLayer:"MODIS_Terra_CorrectedReflectance_TrueColor",alignTo: rb});
+ var id = new SOTE.widget.ImageDownload("imagedownload",{baseLayer:"MODIS_Terra_CorrectedReflectance_TrueColor",alignTo: rb, m:m});
};