[mapserver-commits] r9846 - in trunk: docs/en/ogc mapserver msautotest/wxs msautotest/wxs/expected

svn at osgeo.org svn at osgeo.org
Sun Feb 21 11:40:27 EST 2010


Author: tomkralidis
Date: 2010-02-21 11:40:26 -0500 (Sun, 21 Feb 2010)
New Revision: 9846

Added:
   trunk/msautotest/wxs/expected/wms_getmap130layerlimitexception.xml
Modified:
   trunk/docs/en/ogc/wms_server.txt
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapwms.c
   trunk/msautotest/wxs/expected/wms_cap130.xml
   trunk/msautotest/wxs/expected/wms_cap_latestversion.xml
   trunk/msautotest/wxs/wms_simple.map
Log:
add WMS 1.3.0 LayerLimit support (#3284)


Modified: trunk/docs/en/ogc/wms_server.txt
===================================================================
--- trunk/docs/en/ogc/wms_server.txt	2010-02-21 16:24:36 UTC (rev 9845)
+++ trunk/docs/en/ogc/wms_server.txt	2010-02-21 16:40:26 UTC (rev 9846)
@@ -636,8 +636,9 @@
 
 - valid values for the EXCEPTIONS parameter in a GetMap request are XML, INIMAGE, BLANK
 - valid value  for the EXCEPTIONS parameter in a GetFeatureInfo request is XML
+- LayerLimit is introduced, allowing a server to advertise and limit the
+  number of layers a client is allowed to include in a GetMap request
 
-
 Some  Missing features 
 ----------------------
 
@@ -887,6 +888,13 @@
 - *Description:* (Optional) Same as wms_keywordlist, applied to the root Layer element.
   If not set, then wms_keywordlist will be used.
 
+**wms_layerlimit**
+
+- *WMS TAG Name:* LayerLimit (WMS1.3.0, sect. 7.2.4.3)
+- *Description:* (Optional) The maximum number of layers a WMS client can
+  specify in a GetMap request. If not set, then no limit is imposed.
+
+
 Layer Object Metadata
 ---------------------
 

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2010-02-21 16:24:36 UTC (rev 9845)
+++ trunk/mapserver/HISTORY.TXT	2010-02-21 16:40:26 UTC (rev 9846)
@@ -14,6 +14,8 @@
 Current Version (SVN trunk):
 ----------------------------
 
+- add WMS 1.3.0 LayerLimit support (#3284)
+
 - fix WFS 1.1.0 exception attributes (#3301)
 
 - add more useful error message when query file extension test fails (#3302)

Modified: trunk/mapserver/mapwms.c
===================================================================
--- trunk/mapserver/mapwms.c	2010-02-21 16:24:36 UTC (rev 9845)
+++ trunk/mapserver/mapwms.c	2010-02-21 16:40:26 UTC (rev 9846)
@@ -214,8 +214,6 @@
   return MS_FAILURE; /* so that we can call 'return msWMSException();' anywhere */
 }
 
-
-
 void msWMSSetTimePattern(const char *timepatternstring, char *timestring)
 {
     char *time = NULL;
@@ -408,6 +406,7 @@
   int heightfound = 0;
   char *request = NULL;
   int status = 0;
+  const char *layerlimit = NULL;
 
   char *bboxrequest=NULL;
   const char *sldenabled=NULL;
@@ -479,6 +478,16 @@
         return msWMSException(map, nVersion, NULL);
       }
 
+      if (nVersion >= OWS_1_3_0) {
+        layerlimit = msOWSLookupMetadata(&(map->web.metadata), "MO", "layerlimit");
+        if(layerlimit) {
+          if (numlayers > atoi(layerlimit)) {
+            msSetError(MS_WMSERR, "Number of layers requested exceeds LayerLimit.",
+                     "msWMSLoadGetMapParams()");
+            return msWMSException(map, nVersion, NULL);
+          }
+        }
+      }
 
       for (iLayer=0; iLayer < map->numlayers; iLayer++)
       {
@@ -1975,6 +1984,7 @@
   const char *updatesequence=NULL;
   const char *sldenabled=NULL;
   const char *encoding;
+  const char *layerlimit=NULL;
   char *pszTmp=NULL;
   int i;
   const char *format_list=NULL;
@@ -2169,7 +2179,10 @@
 
   if (nVersion >= OWS_1_3_0)
   {
-      /* LayerLimit not supported. No restriction in MapServer at this point*/
+      layerlimit = msOWSLookupMetadata(&(map->web.metadata), "MO", "layerlimit");
+      if (layerlimit) {
+        msIO_printf("  <LayerLimit>%s</LayerLimit>\n", layerlimit);
+      }
       msIO_printf("  <MaxWidth>%d</MaxWidth>\n", map->maxsize);
       msIO_printf("  <MaxHeight>%d</MaxHeight>\n", map->maxsize);
   }
@@ -3737,8 +3750,6 @@
     return(MS_SUCCESS);
 }
 
-
-
 #endif /* USE_WMS_SVR */
 
 

Modified: trunk/msautotest/wxs/expected/wms_cap130.xml
===================================================================
--- trunk/msautotest/wxs/expected/wms_cap130.xml	2010-02-21 16:24:36 UTC (rev 9845)
+++ trunk/msautotest/wxs/expected/wms_cap130.xml	2010-02-21 16:40:26 UTC (rev 9846)
@@ -32,6 +32,7 @@
   </ContactInformation>
   <Fees>None</Fees>
   <AccessConstraints>None</AccessConstraints>
+  <LayerLimit>1</LayerLimit>
   <MaxWidth>2048</MaxWidth>
   <MaxHeight>2048</MaxHeight>
 </Service>

Modified: trunk/msautotest/wxs/expected/wms_cap_latestversion.xml
===================================================================
--- trunk/msautotest/wxs/expected/wms_cap_latestversion.xml	2010-02-21 16:24:36 UTC (rev 9845)
+++ trunk/msautotest/wxs/expected/wms_cap_latestversion.xml	2010-02-21 16:40:26 UTC (rev 9846)
@@ -32,6 +32,7 @@
   </ContactInformation>
   <Fees>None</Fees>
   <AccessConstraints>None</AccessConstraints>
+  <LayerLimit>1</LayerLimit>
   <MaxWidth>2048</MaxWidth>
   <MaxHeight>2048</MaxHeight>
 </Service>

Added: trunk/msautotest/wxs/expected/wms_getmap130layerlimitexception.xml
===================================================================
--- trunk/msautotest/wxs/expected/wms_getmap130layerlimitexception.xml	                        (rev 0)
+++ trunk/msautotest/wxs/expected/wms_getmap130layerlimitexception.xml	2010-02-21 16:40:26 UTC (rev 9846)
@@ -0,0 +1,8 @@
+Content-type: text/xml
+
+<?xml version='1.0' encoding="ISO-8859-1" standalone="no" ?>
+<ServiceExceptionReport version="1.3.0" xmlns="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/ogc http://schemas.opengis.net/wms/1.3.0/exceptions_1_3_0.xsd">
+<ServiceException>
+msWMSLoadGetMapParams(): WMS server error. Number of layers requested exceeds LayerLimit.
+</ServiceException>
+</ServiceExceptionReport>

Modified: trunk/msautotest/wxs/wms_simple.map
===================================================================
--- trunk/msautotest/wxs/wms_simple.map	2010-02-21 16:24:36 UTC (rev 9845)
+++ trunk/msautotest/wxs/wms_simple.map	2010-02-21 16:40:26 UTC (rev 9846)
@@ -49,6 +49,9 @@
 # GetMap exception (passing SRS instead of CRS)
 # RUN_PARMS: wms_getmap130crsexception.xml [MAPSERV] QUERY_STRING="map=[MAPFILE]&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&SRS=EPSG%3A4326&BBOX=35.18749999863387,-141.0000000021858,90.81250000136613,-51.99999999781419&WIDTH=560&HEIGHT=350&LAYERS=road&STYLES=&FORMAT=image%2Fpng&BGCOLOR=0xFFFFFF&TRANSPARENT=FALSE&EXCEPTIONS=XML" > [RESULT]
 #
+# GetMap exception (number of layers < LayerLimit)
+# RUN_PARMS: wms_getmap130layerlimitexception.xml [MAPSERV] QUERY_STRING="map=[MAPFILE]&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&SRS=EPSG%3A4326&BBOX=35.18749999863387,-141.0000000021858,90.81250000136613,-51.99999999781419&WIDTH=560&HEIGHT=350&LAYERS=road,road&STYLES=&FORMAT=image%2Fpng&BGCOLOR=0xFFFFFF&TRANSPARENT=FALSE&EXCEPTIONS=XML" > [RESULT]
+#
 # GetFeatureInfo
 # RUN_PARMS: wms_getfeatureinfo130.xml [MAPSERV] QUERY_STRING="map=[MAPFILE]&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetFeatureInfo&CRS=EPSG%3A4326&BBOX=35.18749999863387,-141.0000000021858,90.81250000136613,-51.99999999781419&WIDTH=560&HEIGHT=350&LAYERS=road&STYLES=&FORMAT=image%2Fpng&BGCOLOR=0xFFFFFF&TRANSPARENT=FALSE&QUERY_LAYERS=road&INFO_FORMAT=application%2Fvnd.ogc.gml&I=483&J=291&FEATURE_COUNT=5" > [RESULT]
 #
@@ -115,6 +118,7 @@
     "ows_rootlayer_title" "My Layers"
     "ows_rootlayer_abstract" "These are my layers"
     "ows_rootlayer_keywordlist" "layers,list"
+    "ows_layerlimit" "1"
   END
 END
 



More information about the mapserver-commits mailing list