summaryrefslogtreecommitdiff
path: root/misc/openlayers/examples/mvs.html
diff options
context:
space:
mode:
authorChris Schlaeger <chris@linux.com>2014-08-12 21:56:44 +0200
committerChris Schlaeger <chris@linux.com>2014-08-12 21:56:44 +0200
commitea346a785dc1b3f7c156f6fc33da634e1f1a627b (patch)
treeaf67530553d20b6e82ad60fd79593e9c4abf5565 /misc/openlayers/examples/mvs.html
parent59741cd535c47f25971bf8c32b25da25ceadc6d5 (diff)
downloadpostrunner-fb1989bda5d3e0a5472ba7644d57cae197733a8f.zip
Adding jquery, flot and openlayers to be included with the GEM.v0.0.4
Diffstat (limited to 'misc/openlayers/examples/mvs.html')
-rw-r--r--misc/openlayers/examples/mvs.html129
1 files changed, 129 insertions, 0 deletions
diff --git a/misc/openlayers/examples/mvs.html b/misc/openlayers/examples/mvs.html
new file mode 100644
index 0000000..f3866f5
--- /dev/null
+++ b/misc/openlayers/examples/mvs.html
@@ -0,0 +1,129 @@
+<!DOCTYPE html>
+<html>
+<!--
+ This probably needs to be renamed index.html for deployment.
+ Specifically, it needs to be the default page for whatever
+ directory it is in.
+-->
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
+ <meta name="apple-mobile-web-app-capable" content="yes">
+
+ <!-- this gmaps key generated for http://openlayers.org/dev/ -->
+ <script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAA9XNhd8q0UdwNC7YSO4YZghSPUCi5aRYVveCcVYxzezM4iaj_gxQ9t-UajFL70jfcpquH5l1IJ-Zyyw'></script>
+ <!-- Localhost key -->
+ <!--<script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhT2yXp_ZAY8_ufC3CFXhHIE1NvwkxTS6gjckBmeABOGXIUiOiZObZESPg'></script>-->
+<script src="http://openlayers.org/dev/lib/OpenLayers.js"></script>
+
+<script>
+
+function runMVS() {
+ OpenLayers.ProxyHost = '/proxy/?url=';
+ if (document.location.protocol != "file:") {
+ theArgs = OpenLayers.Util.getParameters();
+ } else {
+ theArgs = {};
+ theArgs.center = "0,0";
+ theArgs.zoom = "0";
+ theArgs.data = "textfile.txt";
+ theArgs.controls = 'panzoom,mouse';
+ theArgs.layers = 'openlayers';
+ }
+
+
+ // ----
+ // TODO: Handle all this parsing better.
+ var safeArgs = {};
+
+ var DEFAULT_LAT = 0;
+ var DEFAULT_LON = 0;
+ var DEFAULT_ZOOM_LEVEL = 0;
+ var DEFAULT_CONTROLS = ['panzoom','mouse'];
+ var DEFAULT_LAYERS = ['openlayers'];
+
+ var IDX_LAT = 0;
+ var IDX_LON = 1;
+
+ safeArgs.centerLat = theArgs.center ?
+ parseFloat(theArgs.center.split(",")[IDX_LAT]) : DEFAULT_LAT;
+
+ safeArgs.centerLon = theArgs.center ?
+ parseFloat(theArgs.center.split(",")[IDX_LON]) : DEFAULT_LON;
+
+ safeArgs.zoom = theArgs.zoom ? parseInt(theArgs.zoom) : DEFAULT_ZOOM_LEVEL;
+
+ safeArgs.controls = theArgs.controls ?
+ theArgs.controls.split(",") : DEFAULT_CONTROLS;
+
+ safeArgs.layers = theArgs.layers ?
+ theArgs.layers.split(",") : DEFAULT_LAYERS;
+
+ safeArgs.data = theArgs.data; // TODO: Make this "safe".
+ safeArgs.marker = theArgs.marker; // TODO: Make this "safe".
+
+ // -----
+ var theMVS = new OpenLayers.Map('map', {controls: [], maxResolution: 'auto'});
+ for(var i = 0; i < safeArgs.controls.length; i++) {
+ switch(safeArgs.controls[i]) {
+ case 'panzoombar':
+ theMVS.addControl(new OpenLayers.Control.PanZoomBar());
+ break;
+ case 'panzoom':
+ theMVS.addControl(new OpenLayers.Control.PanZoom());
+ break;
+ case 'layerswitcher':
+ theMVS.addControl(new OpenLayers.Control.LayerSwitcher());
+ break;
+ case 'mouse':
+ theMVS.addControl(new OpenLayers.Control.MouseDefaults());
+ break;
+ }
+ }
+ for(var i = 0; i < safeArgs.layers.length; i++) {
+ switch(safeArgs.layers[i]) {
+ case 'openlayers':
+ theMVS.addLayer(
+ new OpenLayers.Layer.WMS( "OpenLayers WMS",
+ "http://vmap0.tiles.osgeo.org/wms/vmap0",
+ {layers: 'basic'} )
+ );
+ break;
+ case 'nasa':
+ theMVS.addLayer(
+ new OpenLayers.Layer.WMS("NASA Mosaic",
+ "http://t1.hypercube.telascience.org/cgi-bin/landsat7",
+ {"EXCEPTIONS" : "application/vnd.ogc.se_inimage",
+ "format" : "image/jpeg",
+ layers:"landsat7"}
+ ));
+ break;
+ case 'gmaps':
+ theMVS.addLayer(
+ new OpenLayers.Layer.Google( "Google" , {type: G_HYBRID_MAP })
+ );
+ break;
+ }
+ }
+ theMVS.setCenter(new OpenLayers.LonLat(safeArgs.centerLon, safeArgs.centerLat), safeArgs.zoom);
+
+ if (safeArgs.marker) {
+ var m = new OpenLayers.Layer.Markers("Marker");
+ m.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(safeArgs.centerLon, safeArgs.centerLat)));
+ theMVS.addLayer(m);
+ }
+ if (safeArgs.data) {
+ theMVS.addLayer(new OpenLayers.Layer.Text("Data", {location: safeArgs.data}));
+ }
+
+}
+</script>
+</head>
+<body style="margin:0px;"
+ onload="runMVS();">
+<div id="map"
+ style="width: 100%; height: 100%;
+ background: lightyellow;
+ "></div>
+</body>
+</html>