Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Initial download list

Mike McGann732373ab5704
diff --git a/build.xml b/build.xml
index e713326fd..eab4ee147 100644
--- a/build.xml
+++ b/build.xml
@@ -166,7 +166,7 @@
tofile="${build.web-debug.dir}/data/config"/>
<!-- Executable bits -->
- <chmod file="${build.web.dir}/data/echo.cgi" perm="755"/>
+ <chmod file="${build.web.dir}/service/echo.cgi" perm="755"/>
<!-- Combine all css and js files into one file -->
<concat destfile="${build.dir}/minify/worldview.css" force="no">
@@ -310,11 +310,11 @@
</tar>
<tar destfile="${dist.dir}/worldview-debug.tar.bz2" compression="bzip2">
<tarfileset dir="${build.dir}/worldview-debug" prefix="worldview-debug">
- <exclude name="**/data/echo.cgi"/>
+ <exclude name="**/service/echo.cgi"/>
<exclude name="**/bin/eventsGeoRssParser.py"/>
</tarfileset>
- <tarfileset dir="${build.web-debug.dir}/data"
- prefix="worldview-debug/web/data" filemode="755">
+ <tarfileset dir="${build.web-debug.dir}/service"
+ prefix="worldview-debug/web/service" filemode="755">
<include name="echo.cgi"/>
</tarfileset>
<tarfileset dir="${build.bin-debug.dir}"
diff --git a/etc/ant/js.build.xml b/etc/ant/js.build.xml
index 9859ce262..6f406772b 100644
--- a/etc/ant/js.build.xml
+++ b/etc/ant/js.build.xml
@@ -135,6 +135,7 @@
<file name="js/Worldview/DataDownload/Model.js"/>
<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/Widget/Map.js"/>
<file name="js/Worldview/Widget/Palette.js"/>
diff --git a/src/css/dataDownload.css b/src/css/dataDownload.css
index 158321128..14bd6ee27 100644
--- a/src/css/dataDownload.css
+++ b/src/css/dataDownload.css
@@ -15,8 +15,10 @@
}
#DataDownload_SelectionListPanel .bd {
+ background-color: rgb(25, 28, 32);
overflow: auto;
padding: 10px;
+ color: #FFFBE7;
}
#DataDownload_SelectionListPanel ul {
@@ -25,7 +27,43 @@
}
#DataDownload_SelectionListPanel li {
- display: list-item;
+ margin-top: 3px;
+ display: list-item;
+ list-style-type: none;
}
+#DataDownload_SelectionListPanel h3 {
+ font-size: 12pt;
+ font-weight: bold;
+ color: #FFFBE7;
+}
+
+#DataDownload_SelectionListPanel h5 {
+ font-size: 10pt;
+ margin-top: 10px;
+ margin-bottom: 5px;
+ color: #FFFBE7;
+}
+
+#DataDownload_SelectionListPanel a {
+ text-decoration: none;
+}
+
+#DataDownload_SelectionListPanel a:link {
+ color: #82cdfa;
+}
+
+#DataDownload_SelectionListPanel a:visited {
+ color: #82cdfa;
+}
+
+#DataDownload_SelectionListPanel hr {
+ display: block;
+ height: 1px;
+ border: 0;
+ border-top: 1px solid #404040;
+ margin: 1em 0;
+ padding: 0;
+}
+
\ No newline at end of file
diff --git a/src/js/Worldview/DataDownload/Handler/Base.js b/src/js/Worldview/DataDownload/Handler/Base.js
index 7c1a229f0..bc8518265 100644
--- a/src/js/Worldview/DataDownload/Handler/Base.js
+++ b/src/js/Worldview/DataDownload/Handler/Base.js
@@ -57,6 +57,7 @@ Worldview.DataDownload.Handler.Base = function(config, model) {
promise.done(function(data) {
try {
+ markProduct(data);
var results = self._processResults(data);
self.events.trigger("results", results);
} catch ( error ) {
@@ -76,6 +77,14 @@ Worldview.DataDownload.Handler.Base = function(config, model) {
}
};
+ // Results from ECHO do not have any identifier linking it back to the
+ // collection, put in the identifier that Worldview uses.
+ var markProduct = function(data) {
+ $.each(data, function(index, data) {
+ data.product = model.selectedProduct;
+ });
+ };
+
init();
return self;
};
diff --git a/src/js/Worldview/DataDownload/Results/TimeLabel.js b/src/js/Worldview/DataDownload/Results/TimeLabel.js
index 9342314e4..46e1850f7 100644
--- a/src/js/Worldview/DataDownload/Results/TimeLabel.js
+++ b/src/js/Worldview/DataDownload/Results/TimeLabel.js
@@ -40,6 +40,10 @@ Worldview.DataDownload.Results.TimeLabel = function(time) {
var displayEnd = timeEnd.toISOStringTimeHM();
granule.label = displayStart + " - " + displayEnd + suffix;
+
+ granule.downloadLabel = timeStart.toISOStringDate() + ": " +
+ displayStart + " - " + displayEnd;
+
return granule;
};
diff --git a/src/js/Worldview/DataDownload/SelectionListPanel.js b/src/js/Worldview/DataDownload/SelectionListPanel.js
index fee9caf40..935f56ef9 100644
--- a/src/js/Worldview/DataDownload/SelectionListPanel.js
+++ b/src/js/Worldview/DataDownload/SelectionListPanel.js
@@ -10,7 +10,10 @@
*/
Worldview.namespace("DataDownload");
-Worldview.DataDownload.SelectionListPanel = function(model) {
+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 panel;
var self = {};
@@ -39,34 +42,133 @@ Worldview.DataDownload.SelectionListPanel = function(model) {
panel.hide();
};
- var linkText = function(granule) {
- var elements = ["<ul>"];
- $.each(granule.links, function(index, link) {
- var title = ( link.title ) ? link.title : granule.producer_granule_id;
+ var reformatSelection = function() {
+ var selection = {};
+
+ $.each(model.selectedGranules, function(key, granule) {
+ if ( !selection[granule.product] ) {
+ selection[granule.product] = {
+ name: config.products[granule.product].name,
+ granules: [granule],
+ counts: {}
+ };
+ } else {
+ selection[granule.product].granules.push(granule);
+ }
+
+ var product = selection[granule.product];
+ var id = granule.product;
+
+ // For each link that looks like metadata, see if that link is
+ // 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 ( !product.counts[link.href] ) {
+ product.counts[link.href] = 1;
+ } else {
+ product.counts[link.href]++;
+ }
+ }
+ });
+ });
+
+ $.each(selection, function(key, product) {
+ product.links = [];
+ product.list = [];
+
+ // Check the first granule, and populate product level links
+ // where the count equals the number of granules
+ var granule = product.granules[0];
+ $.each(granule.links, function(index, link) {
+ var count = product.counts[link.href];
+ if ( count === product.granules.length ) {
+ product.links.push(reformatLink(link));
+ }
+ });
+
+ $.each(product.granules, function(index, granule) {
+ var item = {
+ label: granule.downloadLabel || granule.label,
+ links: []
+ };
+ $.each(granule.links, function(index, link) {
+ // Skip this link if now at the product level
+ var count = product.counts[link.href];
+ if ( count === product.granules.length ) {
+ return;
+ }
+ // Skip browse images per Kevin's request
+ if ( link.rel === REL_BROWSE ) {
+ return;
+ }
+ item.links.push(reformatLink(link));
+ });
+ product.list.push(item);
+ });
+ });
+
+ return selection;
+ };
+
+ var reformatLink = function(link) {
+ // For title, take it if found, otherwise, use the basename of the
+ // URI
+ return {
+ href: link.href,
+ title: ( link.title ) ? link.title : link.href.split("/").slice(-1)
+ };
+ };
+
+ var linksText = function(links) {
+ var elements = [];
+ elements.push("<ul>");
+ $.each(links, function(index, link) {
elements.push(
"<li>" +
- "<a target='_blank' href='" + link.href + "'>" + title + "</a>" +
- "</li>"
- );
- });
- elements.push["</ul>"];
+ "<a href='" + link.href + "' target='_blank'>" +
+ link.title + "</a>" +
+ "</li>");
+ });
+ elements.push("</ul>");
return elements.join("\n");
};
var granuleText = function(granule) {
- var text = "<li>" + granule.producer_granule_id +
- linkText(granule) + "</li>";
- return text;
+ var elements = [
+ "<ul>",
+ "<li class='granuleTitle'>" + granule.label,
+ linksText(granule.links),
+ "</li>",
+ "</ul>"
+ ];
+ return elements.join("\n");
+ };
+
+ var productText = function(product) {
+ var elements = [
+ "<h3>" + product.name + "</h3>"
+ ];
+
+ if ( product.links && product.links.length > 0 ) {
+ elements.push("<h5>Data Collection Information</h5>");
+ elements.push(linksText(product.links));
+ }
+
+ elements.push("<h5>Selected Data</h5>");
+ $.each(product.list, function(index, item) {
+ elements.push(granuleText(item));
+ });
+ return elements.join("\n");
};
var bodyText = function() {
- var elements = ["<ul>"];
- $.each(model.selectedGranules, function(key, granule) {
- elements.push(granuleText(granule));
+ var selection = reformatSelection();
+ var elements = [];
+ $.each(selection, function(key, product) {
+ elements.push(productText(product));
});
- elements.push("</ul>");
- var text = elements.join("\n");
- console.log(text);
+ var text = elements.join("\n<hr/>\n") + "<br/>";
return text;
};
diff --git a/src/js/Worldview/Widget/DataDownload.js b/src/js/Worldview/Widget/DataDownload.js
index 97dc5304c..cfd1ebfaf 100644
--- a/src/js/Worldview/Widget/DataDownload.js
+++ b/src/js/Worldview/Widget/DataDownload.js
@@ -172,7 +172,8 @@ Worldview.Widget.DataDownload = function(config, spec) {
};
var showSelectionList = function() {
- selectionListPanel = Worldview.DataDownload.SelectionListPanel(model);
+ selectionListPanel =
+ Worldview.DataDownload.SelectionListPanel(config, model);
selectionListPanel.show();
};