Interactive interface for browsing global, full-resolution satellite imagery
Tile debugging service
Mike McGann87d423bd9b3a
diff --git a/Gruntfile.js b/Gruntfile.jsindex a8d9c1f6f..80daab72e 100644--- a/Gruntfile.js+++ b/Gruntfile.js@@ -165,7 +165,7 @@ module.exports = function(grunt) {// Enable executable bits for all CGI programscgi_echo: {- command: "chmod 755 build/<%=pkg%>*/web/service/echo.cgi"+ command: "chmod 755 build/<%=pkg%>*/web/service/*.cgi"},cgi_shorten: {diff --git a/src/js/wv.debug.js b/src/js/wv.debug.jsindex 554a6ba4a..a1c5bad15 100644--- a/src/js/wv.debug.js+++ b/src/js/wv.debug.js@@ -76,10 +76,43 @@ wv.debug = wv.debug || (function() {})();+wv.debug.config = wv.debug.config || function(config) {+ if ( config.parameters.debug === "tiles" ) {+ var tileSize = _.parseInt(config.parameters.tileSize);+ if ( _.isNaN(tileSize) ) {+ throw new Error("No tileSize specified");+ }+ console.log("Debugging tiles with size", tileSize);+ config.layers.debug_tile = {+ id: "debug_tile",+ title: "Debug Tiles",+ subtitle: "Worldview",+ tags: "debug",+ group: "overlays",+ format: "image/svg",+ type: "wmts",+ noTransition: "true",+ projections: {}+ };+ _.each(config.projections, function(proj) {+ config.layers.debug_tile.projections[proj.id] = {+ "source": "debug_tile",+ "matrixSet": tileSize+ }+ });+ config.sources.debug_tile = {+ url: "service/debug_tile.cgi",+ matrixSets: {}+ };+ config.sources.debug_tile.matrixSets[tileSize] = {+ id: tileSize,+ tileSize: [tileSize, tileSize]+ };+ config.layerOrder.push("debug_tile");+ config.defaults.startingLayers.push({id: "debug_tile"});+ }+};-/**- * @class wv.debug.gibs- */wv.debug.layers = wv.debug.layers || function(ui, models, config) {var type;diff --git a/src/js/wv.main.js b/src/js/wv.main.jsindex 03036cd46..d799f6b84 100644--- a/src/js/wv.main.js+++ b/src/js/wv.main.js@@ -54,6 +54,8 @@ $(function() {// Export for debuggingwvx.config = config;+ wv.debug.config(config);+// Load any additional scripts as neededif ( config.scripts ) {_.each(config.scripts, function(script) {diff --git a/src/service/debug_tile.cgi b/src/service/debug_tile.cginew file mode 100755index 000000000..51fa494e4--- /dev/null+++ b/src/service/debug_tile.cgi@@ -0,0 +1,27 @@+#!/usr/bin/python++import cgi++fields = cgi.FieldStorage()++size = int(fields["TILEMATRIXSET"].value)+z = fields["TILEMATRIX"].value+x = fields["TILEROW"].value+y = fields["TILECOL"].value++print "Content-type: image/svg+xml"+print """+<svg version="1.1"+ baseProfile="full"+ width="%d" height="%d"+ xmlns="http://www.w3.org/2000/svg">++ <line x1="0" y1="0" x2="%d" y2="0" stroke="rgb(255, 0, 0)" stroke-width="5"/>+ <line x1="0" y1="0" x2="0" y2="%d" stroke="rgb(255, 0, 0)" stroke-width="5"/>++ <rect width="128" height="30" fill="rgb(255, 0, 0)" />++ <text x="10" y="21" font-size="18" text-anchor="start" fill="white">%s / %s / %s</text>++</svg>+""" % (size, size, size, size, z, x, y)