[mapguide-commits] r9691 - sandbox/jng/ogc_viewer_representation/Server/src/Wms

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Jul 28 07:12:58 PDT 2020


Author: jng
Date: 2020-07-28 07:12:57 -0700 (Tue, 28 Jul 2020)
New Revision: 9691

Modified:
   sandbox/jng/ogc_viewer_representation/Server/src/Wms/1.3.0.xml.awd
Log:
Add WMS GetMap template for OpenLayers viewer

Modified: sandbox/jng/ogc_viewer_representation/Server/src/Wms/1.3.0.xml.awd
===================================================================
--- sandbox/jng/ogc_viewer_representation/Server/src/Wms/1.3.0.xml.awd	2020-07-28 12:41:32 UTC (rev 9690)
+++ sandbox/jng/ogc_viewer_representation/Server/src/Wms/1.3.0.xml.awd	2020-07-28 14:12:57 UTC (rev 9691)
@@ -423,7 +423,70 @@
   "features": [<?EnumFeatureInfo using="&FeatureInfo.json;" ?>]
 }</Response>
 
+<!--
 
+  WMS GetFeatureInfo - OpenLayers viewer
+
+-->
+<Response request="GetMap" content-type="application/openlayers">
+<!DOCTYPE html>
+<html>
+  <head>
+    <!-- The line below is only needed for old environments like Internet Explorer and Android 4.x -->
+    <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=fetch,requestAnimationFrame,Element.prototype.classList,URL"></script>
+    <!-- Pointer events polyfill for old browsers, see https://caniuse.com/#feat=pointer -->
+    <script src="https://unpkg.com/@openlayers/pepjs"></script>
+    <script type="text/javascript" src="../viewerfiles/ol.js" charset="utf-8"></script>
+    <link rel="stylesheet" href="../viewerfiles/ol.css" />
+    <style type="text/css">
+      .map {
+        width: 100%;
+        height:400px;
+      }
+    </style>
+  </head>
+  <body>
+    <div id="map" class="map"></div>
+    <script type="text/javascript">
+      var bounds = [&Viewer.BBOX;];
+      // Regardless of WMS version, normalize the BBOX to address any
+      // axis orientation
+      bounds = [
+        Math.min(bounds[0], bounds[2]),
+        Math.min(bounds[1], bounds[3]),
+        Math.max(bounds[0], bounds[2]),
+        Math.max(bounds[1], bounds[3])
+      ];
+      var layers = [
+        new ol.layer.Tile({
+          source: new ol.source.OSM()
+        }),
+        new ol.layer.Image({
+          source: new ol.source.ImageWMS({
+            url: "&Viewer.SelfUrl;",
+            params: {
+              "LAYERS": "&Viewer.LayersParam;",
+              "TRANSPARENT": "TRUE"
+            },
+            ratio: 1
+          })
+        })
+      ];
+      var view = new ol.View({
+        projection: "&Viewer.SRS;"
+      });
+      view.fit(bounds);
+      var map = new ol.Map({
+        layers: layers,
+        target: "map",
+        view: view
+      });
+
+    </script>
+  </body>
+</html>
+</Response>
+
 <!--
 
   Exception format - XML



More information about the mapguide-commits mailing list