[mapguide-commits] r9252 - in sandbox/jng/ogc: Server/src/Wms Web/src/HttpHandler

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Sun Nov 12 01:01:58 PST 2017


Author: jng
Date: 2017-11-12 01:01:57 -0800 (Sun, 12 Nov 2017)
New Revision: 9252

Modified:
   sandbox/jng/ogc/Server/src/Wms/1.0.0.xml.awd
   sandbox/jng/ogc/Server/src/Wms/1.1.0.xml.awd
   sandbox/jng/ogc/Server/src/Wms/1.1.1.xml.awd
   sandbox/jng/ogc/Server/src/Wms/1.3.0.xml.awd
   sandbox/jng/ogc/Web/src/HttpHandler/WmsFeatureInfo.cpp
Log:
Modify MgWmsFeatureInfo to emit a FeatureInfo.IsLast XML entity. Once again this is primarily needed for GeoJSON so we know when to and when not to emit the delimiting ",".

Also modify all the GeoJSON templates so that the top-level response is a GeoJSON FeatureCollection

Modified: sandbox/jng/ogc/Server/src/Wms/1.0.0.xml.awd
===================================================================
--- sandbox/jng/ogc/Server/src/Wms/1.0.0.xml.awd	2017-11-11 14:24:17 UTC (rev 9251)
+++ sandbox/jng/ogc/Server/src/Wms/1.0.0.xml.awd	2017-11-12 09:01:57 UTC (rev 9252)
@@ -97,15 +97,12 @@
 
  </Define>
 
- <!-- 
- Ugly, but we have to do 2 iteration passes to output the right
- content in the right places for GeoJSON
-  -->
  <Define item="FeatureInfo.json">{
     "type": "Feature",
     "properties": {<?EnumFeatureProperties using="&FeatureProperty.json;" ?>}
     <?EnumFeatureGeometries using="&FeatureGeometry.json;" ?>
-}</Define>
+}<?If l="&FeatureInfo.IsLast" op="eq" r="0"?>,<?Endif?></Define>
+
  <Define item="FeatureProperty.xml">
   <Property name="&FeatureProperty.Name;" value="&FeatureProperty.Value;"></Property>
  </Define>
@@ -410,9 +407,10 @@
   WMS GetFeatureInfo - (Geo)JSON
 
 -->
-<Response request="GetFeatureInfo" content-type="application/json">
-  <?EnumFeatureInfo using="&FeatureInfo.json;" ?>
-</Response>
+<Response request="GetFeatureInfo" content-type="application/json">{
+  "type": "FeatureCollection",
+  "features": [<?EnumFeatureInfo using="&FeatureInfo.json;" ?>]
+}</Response>
 
 <!--
 

Modified: sandbox/jng/ogc/Server/src/Wms/1.1.0.xml.awd
===================================================================
--- sandbox/jng/ogc/Server/src/Wms/1.1.0.xml.awd	2017-11-11 14:24:17 UTC (rev 9251)
+++ sandbox/jng/ogc/Server/src/Wms/1.1.0.xml.awd	2017-11-12 09:01:57 UTC (rev 9252)
@@ -99,15 +99,11 @@
 
  </Define>
 
- <!-- 
- Ugly, but we have to do 2 iteration passes to output the right
- content in the right places for GeoJSON
-  -->
  <Define item="FeatureInfo.json">{
     "type": "Feature",
     "properties": {<?EnumFeatureProperties using="&FeatureProperty.json;" ?>}
     <?EnumFeatureGeometries using="&FeatureGeometry.json;" ?>
-}</Define>
+}<?If l="&FeatureInfo.IsLast" op="eq" r="0"?>,<?Endif?></Define>
 
  <Define item="FeatureProperty.xml">
   <Property name="&FeatureProperty.Name;" value="&FeatureProperty.Value;"></Property>
@@ -435,9 +431,10 @@
   WMS GetFeatureInfo - (Geo)JSON
 
 -->
-<Response request="GetFeatureInfo" content-type="application/json">
-  <?EnumFeatureInfo using="&FeatureInfo.json;" ?>
-</Response>
+<Response request="GetFeatureInfo" content-type="application/json">{
+  "type": "FeatureCollection",
+  "features": [<?EnumFeatureInfo using="&FeatureInfo.json;" ?>]
+}</Response>
 
 
 <!--

Modified: sandbox/jng/ogc/Server/src/Wms/1.1.1.xml.awd
===================================================================
--- sandbox/jng/ogc/Server/src/Wms/1.1.1.xml.awd	2017-11-11 14:24:17 UTC (rev 9251)
+++ sandbox/jng/ogc/Server/src/Wms/1.1.1.xml.awd	2017-11-12 09:01:57 UTC (rev 9252)
@@ -100,15 +100,11 @@
 
  </Define>
 
- <!-- 
- Ugly, but we have to do 2 iteration passes to output the right
- content in the right places for GeoJSON
-  -->
  <Define item="FeatureInfo.json">{
     "type": "Feature",
     "properties": {<?EnumFeatureProperties using="&FeatureProperty.json;" ?>}
     <?EnumFeatureGeometries using="&FeatureGeometry.json;" ?>
-}</Define>
+}<?If l="&FeatureInfo.IsLast" op="eq" r="0"?>,<?Endif?></Define>
 
  <Define item="FeatureProperty.xml">
   <Property name="&FeatureProperty.Name;" value="&FeatureProperty.Value;"></Property>
@@ -415,9 +411,10 @@
   WMS GetFeatureInfo - (Geo)JSON
 
 -->
-<Response request="GetFeatureInfo" content-type="application/json">
-  <?EnumFeatureInfo using="&FeatureInfo.json;" ?>
-</Response>
+<Response request="GetFeatureInfo" content-type="application/json">{
+  "type": "FeatureCollection",
+  "features": [<?EnumFeatureInfo using="&FeatureInfo.json;" ?>]
+}</Response>
 
 
 <!--

Modified: sandbox/jng/ogc/Server/src/Wms/1.3.0.xml.awd
===================================================================
--- sandbox/jng/ogc/Server/src/Wms/1.3.0.xml.awd	2017-11-11 14:24:17 UTC (rev 9251)
+++ sandbox/jng/ogc/Server/src/Wms/1.3.0.xml.awd	2017-11-12 09:01:57 UTC (rev 9252)
@@ -110,15 +110,11 @@
 
  </Define>
 
- <!-- 
- Ugly, but we have to do 2 iteration passes to output the right
- content in the right places for GeoJSON
-  -->
  <Define item="FeatureInfo.json">{
     "type": "Feature",
     "properties": {<?EnumFeatureProperties using="&FeatureProperty.json;" ?>}
     <?EnumFeatureGeometries using="&FeatureGeometry.json;" ?>
-}</Define>
+}<?If l="&FeatureInfo.IsLast" op="eq" r="0"?>,<?Endif?></Define>
 
  <Define item="FeatureProperty.xml">
   <Property name="&FeatureProperty.Name;" value="&FeatureProperty.Value;"></Property>
@@ -422,9 +418,10 @@
   WMS GetFeatureInfo - (Geo)JSON
 
 -->
-<Response request="GetFeatureInfo" content-type="application/json">
-  <?EnumFeatureInfo using="&FeatureInfo.json;" ?>
-</Response>
+<Response request="GetFeatureInfo" content-type="application/json">{
+  "type": "FeatureCollection",
+  "features": [<?EnumFeatureInfo using="&FeatureInfo.json;" ?>]
+}</Response>
 
 
 <!--

Modified: sandbox/jng/ogc/Web/src/HttpHandler/WmsFeatureInfo.cpp
===================================================================
--- sandbox/jng/ogc/Web/src/HttpHandler/WmsFeatureInfo.cpp	2017-11-11 14:24:17 UTC (rev 9251)
+++ sandbox/jng/ogc/Web/src/HttpHandler/WmsFeatureInfo.cpp	2017-11-12 09:01:57 UTC (rev 9252)
@@ -19,6 +19,7 @@
 #include "WmsFeatureInfo.h"
 #include "WmsFeatureProperties.h"
 
+CPSZ kpszIsLast = _("FeatureInfo.IsLast");
 CPSZ kpszDefinitionFeatureInfoLayerName = _("FeatureInfo.LayerName");
 CPSZ kpszLayerNameProperty = _("_MgLayerName");
 
@@ -59,6 +60,7 @@
                 dictionary.AddDefinition(kpszDefinitionFeatureInfoLayerName, value);
             }
         }
+        dictionary.AddDefinition(kpszIsLast, (m_index < m_propertyCollection->GetCount() - 1) ? L"0" : L"1");
     }
 }
 



More information about the mapguide-commits mailing list