[mapguide-commits] r9550 - in sandbox/jng/tiling_v3: Doc/samples/ol2samples/hybrid Doc/samples/ol2samples/xyz UnitTest/TestData/Samples/Sheboygan/Library/Samples/Sheboygan/TileSets

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Jun 17 04:54:46 PDT 2019


Author: jng
Date: 2019-06-17 04:54:46 -0700 (Mon, 17 Jun 2019)
New Revision: 9550

Added:
   sandbox/jng/tiling_v3/Doc/samples/ol2samples/xyz/index_ol.html
Modified:
   sandbox/jng/tiling_v3/Doc/samples/ol2samples/hybrid/index.html
   sandbox/jng/tiling_v3/UnitTest/TestData/Samples/Sheboygan/Library/Samples/Sheboygan/TileSets/SheboyganXYZ.TileSetDefinition_CONTENT.xml
Log:
- Add XYZ sample to verify XYZ tile sets are consumable in ol3+
- Fix up extents of sample XYZ tile set. Its bounds were in LL84 coordinates when it should be WGS84.PseudoMercator coordinates (per RFC 140 errata)
   - With this change, we can confirm that the "hybrid" example can now work with XYZ tile sets as well.

Modified: sandbox/jng/tiling_v3/Doc/samples/ol2samples/hybrid/index.html
===================================================================
--- sandbox/jng/tiling_v3/Doc/samples/ol2samples/hybrid/index.html	2019-06-16 14:56:56 UTC (rev 9549)
+++ sandbox/jng/tiling_v3/Doc/samples/ol2samples/hybrid/index.html	2019-06-17 11:54:46 UTC (rev 9550)
@@ -114,6 +114,7 @@
                     activeMap.destroy();
                 }
                 activeMap = new MapViewModel("#wrap", data, jqXHR.responseText.length);
+                $("#error").html("");
             }).error(function (jqXHR, textStatus, errorThrown) {
                 $("#error").html(jqXHR.responseText);
             });

Added: sandbox/jng/tiling_v3/Doc/samples/ol2samples/xyz/index_ol.html
===================================================================
--- sandbox/jng/tiling_v3/Doc/samples/ol2samples/xyz/index_ol.html	                        (rev 0)
+++ sandbox/jng/tiling_v3/Doc/samples/ol2samples/xyz/index_ol.html	2019-06-17 11:54:46 UTC (rev 9550)
@@ -0,0 +1,74 @@
+<html>
+    <head>
+        <title>Sheboygan map as XYZ</title>
+        <link rel="stylesheet" href="../assets/ol.css" />
+        <style type="text/css">
+            #error { color: red; }
+            #wrap { width: 900; }
+            #map { width: 400; height: 300; float: left; border: 1px solid black; }
+            #main { margin-top: 50px; padding-top: 20px; }
+        </style>
+        <script type="text/javascript" src="../assets/ol-debug.js"></script>
+        <script type="text/javascript" src="../assets/jquery-1.10.2.min.js"></script>
+        <script type="text/javascript">
+
+        //This sample is assumed to be hosted at http://servername/mapguide/ol2samples/xyz/index_ol.html
+        var mapAgentUrl = "../../mapagent/mapagent.fcgi";
+
+        $(document).ready(function() {
+            //NOTE: Your map definition can be in any coordinate system as long as it it transformable to LL84
+            //
+            //But the ol3 tile layer must remain as EPSG:3857
+
+            var map = new ol.Map({
+              layers: [
+                new ol.layer.Tile({
+                  source: new ol.source.OSM({
+                    attributions: [
+                      new ol.Attribution({
+                        html: 'Tiles © <a href="http://www.openstreetmap.org/">' +
+                            'OpenStreetMap</a>'
+                      }),
+                      ol.source.OSM.ATTRIBUTION
+                    ],
+                    url: 'http://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png'
+                  })
+                }),
+                new ol.layer.Tile({
+                  source: new ol.source.XYZ({
+                    url: mapAgentUrl + "?OPERATION=GETTILEIMAGE&VERSION=1.2.0&CLIENTAGENT=OpenLayers&USERNAME=Anonymous&MAPDEFINITION=Library://Samples/Sheboygan/TileSets/SheboyganXYZ.TileSetDefinition&BASEMAPLAYERGROUPNAME=Base+Layer+Group&TILECOL={y}&TILEROW={x}&SCALEINDEX={z}"
+                  })
+                })
+              ],
+              renderer: 'canvas',
+              target: document.getElementById('map'),
+              view: new ol.View({
+                center: ol.proj.transform([-87.7302542509315, 43.744459064634], 'EPSG:4326', 'EPSG:3857'),
+                minZoom: 10,
+                maxZoom: 19,
+                zoom: 12
+              })
+            });
+        });
+
+        </script>
+    </head>
+    <body>
+        <div id="main">
+            <div class="container">
+                <div class="alert alert-info">
+                    <p>This example demonstrates a Map Definition being consumed as a <strong>XYZ layer</strong> via the MapGuide REST API with <a href="http://openlayers.org/">OpenLayers 3</a>.</p>
+                    <p>An OpenStreetMap layer is included as a backdrop for context</p>
+                    <strong>For maximum visual fidelity, your Map Definition should be in WGS84.PseudoMercator</strong>
+                    <p>Sample not loading? <a href="../data/load.php">Check that the required resources have been loaded</a></p>
+                </div>
+                <div id="error">
+                </div>
+                <div id="wrap">
+                    <div id="map">
+                    </div>
+                </div>
+            </div>
+        </div>
+    </body>
+</html>

Modified: sandbox/jng/tiling_v3/UnitTest/TestData/Samples/Sheboygan/Library/Samples/Sheboygan/TileSets/SheboyganXYZ.TileSetDefinition_CONTENT.xml
===================================================================
--- sandbox/jng/tiling_v3/UnitTest/TestData/Samples/Sheboygan/Library/Samples/Sheboygan/TileSets/SheboyganXYZ.TileSetDefinition_CONTENT.xml	2019-06-16 14:56:56 UTC (rev 9549)
+++ sandbox/jng/tiling_v3/UnitTest/TestData/Samples/Sheboygan/Library/Samples/Sheboygan/TileSets/SheboyganXYZ.TileSetDefinition_CONTENT.xml	2019-06-17 11:54:46 UTC (rev 9550)
@@ -12,10 +12,10 @@
     </Parameter>
   </TileStoreParameters>
   <Extents>
-    <MinX>-87.79786601383196</MinX>
-    <MaxX>-87.66452777186925</MaxX>
-    <MinY>43.6868578621819</MinY>
-    <MaxY>43.8037962206133</MaxY>
+    <MinX>-9769953.6613122653</MinX>
+    <MaxX>-9762220.7994439267</MaxX>
+    <MinY>5417808.8801717851</MinY>
+    <MaxY>5434161.2241863841</MaxY>
   </Extents>
   <BaseMapLayerGroup>
     <Name>Base Layer Group</Name>



More information about the mapguide-commits mailing list