Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

With wget list

Mike McGann19e86d8f718f
diff --git a/etc/ant/js.build.xml b/etc/ant/js.build.xml
index 6f406772b..4311ba520 100644
--- a/etc/ant/js.build.xml
+++ b/etc/ant/js.build.xml
@@ -96,6 +96,7 @@
<file name="js/Worldview/Map/TWMSLayer.js"/>
<file name="js/Worldview/Map/HoverControl.js"/>
+ <file name="js/Worldview/DataDownload/ECHO.js"/>
<file name="js/Worldview/DataDownload/ECHO/Client.js"/>
<file name="js/Worldview/DataDownload/ECHO/Geometry.js"/>
<file name="js/Worldview/DataDownload/ECHO/MockClient.js"/>
@@ -136,6 +137,7 @@
<file name="js/Worldview/DataDownload/ProductSelector.js"/>
<file name="js/Worldview/DataDownload/MapController.js"/>
<file name="js/Worldview/DataDownload/SelectionListPanel.js"/>
+ <file name="js/Worldview/DataDownload/LinkPage.js"/>
<file name="js/Worldview/Widget/Map.js"/>
<file name="js/Worldview/Widget/Palette.js"/>
diff --git a/src/index.html b/src/index.html
index 9d6e98920..1c29f72ea 100644
--- a/src/index.html
+++ b/src/index.html
@@ -158,6 +158,7 @@
<!-- link.dev --> <script type="text/javascript" src="js/Worldview/Map/TWMSLayer.js"></script>
<!-- link.dev --> <script type="text/javascript" src="js/Worldview/Map/HoverControl.js"></script>
+ <!-- link.dev --> <script type="text/javascript" src="js/Worldview/DataDownload/ECHO.js"></script>
<!-- link.dev --> <script type="text/javascript" src="js/Worldview/DataDownload/ECHO/Client.js"></script>
<!-- link.dev --> <script type="text/javascript" src="js/Worldview/DataDownload/ECHO/Geometry.js"></script>
<!-- link.dev --> <script type="text/javascript" src="js/Worldview/DataDownload/ECHO/MockClient.js"></script>
@@ -198,6 +199,7 @@
<!-- link.dev --> <script type="text/javascript" src="js/Worldview/DataDownload/ProductSelector.js"></script>
<!-- link.dev --> <script type="text/javascript" src="js/Worldview/DataDownload/MapController.js"></script>
<!-- link.dev --> <script type="text/javascript" src="js/Worldview/DataDownload/SelectionListPanel.js"></script>
+ <!-- link.dev --> <script type="text/javascript" src="js/Worldview/DataDownload/LinkPage.js"></script>
<!-- link.dev --> <script type="text/javascript" src="js/Worldview/Widget/Map.js"></script>
<!-- link.dev --> <script type="text/javascript" src="js/Worldview/Widget/Palette.js"></script>
diff --git a/src/js/Worldview/DataDownload/ECHO.js b/src/js/Worldview/DataDownload/ECHO.js
new file mode 100644
index 000000000..66a84284f
--- /dev/null
+++ b/src/js/Worldview/DataDownload/ECHO.js
@@ -0,0 +1,23 @@
+/*
+ * NASA Worldview
+ *
+ * This code was originally developed at NASA/Goddard Space Flight Center for
+ * the Earth Science Data and Information System (ESDIS) project.
+ *
+ * Copyright (C) 2013 United States Government as represented by the
+ * Administrator of the National Aeronautics and Space Administration.
+ * All Rights Reserved.
+ */
+
+Worldview.namespace("DataDownload");
+
+Worldview.DataDownload.ECHO = function() {
+
+ var ns = {};
+
+ ns.REL_DATA = "http://esipfed.org/ns/fedsearch/1.1/data#";
+ ns.REL_BROWSE = "http://esipfed.org/ns/fedsearch/1.1/browse#";
+
+ return ns;
+
+}();
diff --git a/src/js/Worldview/DataDownload/LinkPage.js b/src/js/Worldview/DataDownload/LinkPage.js
new file mode 100644
index 000000000..923c9384d
--- /dev/null
+++ b/src/js/Worldview/DataDownload/LinkPage.js
@@ -0,0 +1,109 @@
+/*
+ * NASA Worldview
+ *
+ * This code was originally developed at NASA/Goddard Space Flight Center for
+ * the Earth Science Data and Information System (ESDIS) project.
+ *
+ * Copyright (C) 2013 United States Government as represented by the
+ * Administrator of the National Aeronautics and Space Administration.
+ * All Rights Reserved.
+ */
+Worldview.namespace("DataDownload");
+
+Worldview.DataDownload.LinkPage = (function() {
+
+ var ns = {};
+
+ ns.show = function(selection) {
+ var text = window.open('');
+ text.document.write("<html>");
+ writeHeader(text.document);
+ writePreamble(text.document);
+ $.each(selection, function(key, product) {
+ writeProduct(text.document, product);
+
+ });
+ text.document.write("</div></body></html>");
+ text.document.close();
+ };
+
+ var writeHeader = function(doc) {
+ doc.write(
+ "<header>" +
+ "<title>Worldview URL Download List</title>" +
+
+ "<style>" +
+ "body { " +
+ "background-color: rgb(25, 28, 32);" +
+ "}" +
+ "h3 { " +
+ "margin-top: 0;" +
+ "}" +
+ "h4 { " +
+ "margin-bottom: 0;" +
+ "}" +
+ "#page { " +
+ "background-color: #ffffff;" +
+ "margin: 20px; " +
+ "padding: 20px; " +
+ "border-radius: 5px; " +
+ "}" +
+ "pre {" +
+ "background-color: #eeeeee;" +
+ "padding: 5px;" +
+ "border: 1px dashed #dddddd;" +
+ "}" +
+ ".label {" +
+ "margin-top: 10px; " +
+ "font-style: italic;" +
+ "color: #808080;" +
+ "}" +
+ "</style>" +
+ "</header>"
+ );
+ };
+
+ var writePreamble = function(doc) {
+ doc.write(
+ "<body>" +
+ "<div id='page'>" +
+ "<div id='instructions'>" +
+ "<h3>Using wget</h3>" +
+ "Save this HTML page as <code>wget.html</code> to your " +
+ "local computer. To download: " +
+ "<pre>" +
+ "wget --input-file=wget.html --force-html" +
+ "</pre>" +
+ "If User Registration System (URS) credentials are required, " +
+ "create a file, only readable by you, called " +
+ "<code>urs.credentials</code> with the following:" +
+ "<pre>" +
+ "user=<i>urs_user</i>\n" +
+ "password=<i>urs_password</i>" +
+ "</pre>" +
+ "where <i>urs_user</i> is your URS user name and " +
+ "<i>urs_password</i> is your URS password. To download: " +
+ "<pre>" +
+ "wget --input-file=wget.html --force-html --config=urs.credentials" +
+ "</pre>" +
+ "</div>"
+ );
+ };
+
+ var writeProduct = function(doc, product) {
+ doc.write("<h4>" + product.name + "</h4>");
+ $.each(product.list, function(index, item) {
+ doc.write("<div class='label'>" + item.label + "</div>");
+ $.each(item.links, function(index, link) {
+ doc.write(
+ "<div>" +
+ "<a href='" + link.href + "'>" + link.href + "</a>" +
+ "</div>"
+ );
+ });
+ });
+ };
+
+ return ns;
+
+})();
diff --git a/src/js/Worldview/DataDownload/SelectionListPanel.js b/src/js/Worldview/DataDownload/SelectionListPanel.js
index 6a8c28cbb..17c281373 100644
--- a/src/js/Worldview/DataDownload/SelectionListPanel.js
+++ b/src/js/Worldview/DataDownload/SelectionListPanel.js
@@ -12,9 +12,8 @@ Worldview.namespace("DataDownload");
Worldview.DataDownload.SelectionListPanel = function(config, model) {
- var REL_DATA = "http://esipfed.org/ns/fedsearch/1.1/data#";
- var REL_BROWSE = "http://esipfed.org/ns/fedsearch/1.1/browse#";
-
+ var echo = Worldview.DataDownload.ECHO;
+
var NOTICE =
"<div id='DataDownload_Notice'>" +
"<img class='icon' src='images/info-icon-blue.svg'>" +
@@ -51,7 +50,9 @@ Worldview.DataDownload.SelectionListPanel = function(config, model) {
setTimeout(function() { panel.destroy(); }, 25);
});
- $("#DataDownload_SelectionListPanel a.wget").click(showTextURLs);
+ $("#DataDownload_SelectionListPanel a.wget").click(function() {
+ Worldview.DataDownload.LinkPage.show(selection);
+ });
};
self.hide = function() {
@@ -79,7 +80,7 @@ Worldview.DataDownload.SelectionListPanel = function(config, model) {
// repeated in all granules for that product. If so, we want to
// bump that up to product level instead of at the granule level.
$.each(granule.links, function(index, link) {
- if ( link.rel !== REL_DATA && link.rel !== REL_BROWSE ) {
+ if ( link.rel !== echo.REL_DATA && link.rel !== echo.REL_BROWSE ) {
if ( !product.counts[link.href] ) {
product.counts[link.href] = 1;
} else {
@@ -115,7 +116,7 @@ Worldview.DataDownload.SelectionListPanel = function(config, model) {
return;
}
// Skip browse images per Kevin's request
- if ( link.rel === REL_BROWSE ) {
+ if ( link.rel === echo.REL_BROWSE ) {
return;
}
item.links.push(reformatLink(link));
@@ -183,7 +184,7 @@ Worldview.DataDownload.SelectionListPanel = function(config, model) {
var elements = [
NOTICE,
"<div class='wget'>",
- "<a class='wget' href='#'>Text URLs (wget)</a>",
+ "<a class='wget' href='#'>URL list (wget)</a>",
"</div>"
];
$.each(selection, function(key, product) {
@@ -192,29 +193,7 @@ Worldview.DataDownload.SelectionListPanel = function(config, model) {
var text = elements.join("\n<br/>\n") + "<br/>";
return text;
};
-
- var showTextURLs = function() {
- var text = window.open('');
- text.document.write("<html><body><ul>");
- $.each(selection, function(key, product) {
- $.each(product.list, function(index, item) {
- $.each(item.links, function(index, link) {
- writeLink(text.document, link);
- });
- });
- });
- text.document.write("</ul></body></html>");
- text.document.close();
- };
-
- var writeLink = function(doc, link) {
- doc.write(
- "<li>" +
- "<a href='" + link.href + "'>" + link.href + "</a>" +
- "</li>"
- );
- };
-
+
return self;
};