[mapserver-commits] r12332 - in trunk/mapserver/mapcache: . include src

svn at osgeo.org svn at osgeo.org
Fri Aug 26 07:17:33 EDT 2011


Author: tbonfort
Date: 2011-08-26 04:17:33 -0700 (Fri, 26 Aug 2011)
New Revision: 12332

Modified:
   trunk/mapserver/mapcache/geocache.xml
   trunk/mapserver/mapcache/include/geocache.h
   trunk/mapserver/mapcache/src/configuration.c
   trunk/mapserver/mapcache/src/grid.c
   trunk/mapserver/mapcache/src/service_wms.c
Log:
fix computation of matrixset topleftcorner

closes issue 60.
thomas.bonfort | 2011-03-08 14:43:25 +0100 (Tue, 08 Mar 2011)

Modified: trunk/mapserver/mapcache/geocache.xml
===================================================================
--- trunk/mapserver/mapcache/geocache.xml	2011-08-26 11:17:27 UTC (rev 12331)
+++ trunk/mapserver/mapcache/geocache.xml	2011-08-26 11:17:33 UTC (rev 12332)
@@ -29,11 +29,20 @@
 
       <!-- 
            the spatial reference this tileset is in. a WMS client will need this for
-           getMap requests.
+           getMap requests. This is the srs that will be sent to the WMS source during
+           a request, make sure that this srs is supported by the wms.
       -->
       <srs>epsg:4326</srs>
 
       <!--
+           equivalent values for the SRS that can be requested by a client.
+           this value is essentially here to be able to support:
+            - epsg:900913 and epsg:3857 for the googleMapsCompatible gridset
+            - epsg:2154 and IGNF:LAMB93
+      -->
+      <srsalias>epsg:foobar</srsalias>
+
+      <!--
            width and height of tiles. 256x256 is the usual size
       -->
       <size>256 256</size>
@@ -87,38 +96,6 @@
          </grid>
 
          <grid>
-            <name>google</name>
-            <metadata>
-               <title>GoogleMapsCompatible</title>
-               <WellKnownScaleSet>urn:ogc:def:wkss:OGC:1.0:GoogleMapsCompatible</WellKnownScaleSet>
-            </metadata>
-            <extent>-20037508.3427892480,-20037508.3427892480,20037508.3427892480,20037508.3427892480</extent>
-            <srs>epsg:900913</srs>
-            <size>256 256</size>
-            <resolutions>
-               156543.0339280410
-               78271.51696402048
-               39135.75848201023
-               19567.87924100512
-               9783.939620502561
-               4891.969810251280
-               2445.984905125640
-               1222.992452562820
-               611.4962262814100
-               305.7481131407048
-               152.8740565703525
-               76.43702828517624
-               38.21851414258813
-               19.10925707129406
-               9.554628535647032
-               4.777314267823516
-               2.388657133911758
-               1.194328566955879
-               0.5971642834779395
-            </resolutions>
-         </grid>
-
-         <grid>
             <name>GoogleMapsCompatible</name>
             <metadata>
                <title>GoogleMapsCompatible</title>
@@ -126,6 +103,7 @@
             </metadata>
             <extent>-20037508.3427892480,-20037508.3427892480,20037508.3427892480,20037508.3427892480</extent>
             <srs>epsg:3857</srs>
+            <srsalias>epsg:900913</srsalias>
             <size>256 256</size>
             <resolutions>
                156543.0339280410
@@ -296,7 +274,7 @@
          <params>
             <FORMAT>image/png</FORMAT>
             <LAYERS>default</LAYERS>
-            <MAP>/Users/tbonfort/dev/mapserver-utils/osm-mapserver.map</MAP>
+            <MAP>/home/tbonfort/dev/mapserver-utils/osm-mapserver.map</MAP>
          </params>
       </getmap>
    </source>
@@ -362,7 +340,7 @@
          return images in the grid's srs.
       -->
          <grid restricted_extent="-10 40 10 50">WGS84</grid>
-      <grid>google</grid>
+         <grid>GoogleMapsCompatible</grid>
 
       <!-- metadata
          optional metadata tags used for responding to GetCapabilities request.
@@ -483,7 +461,7 @@
       <cache>disk</cache>
       <format>PNG</format>
       <grid>WGS84</grid>
-      <grid>google</grid>
+      <grid>GoogleMapsCompatible</grid>
       <metatile>5 5</metatile>
       <metabuffer>10</metabuffer>
    </tileset>

Modified: trunk/mapserver/mapcache/include/geocache.h
===================================================================
--- trunk/mapserver/mapcache/include/geocache.h	2011-08-26 11:17:27 UTC (rev 12331)
+++ trunk/mapserver/mapcache/include/geocache.h	2011-08-26 11:17:33 UTC (rev 12332)
@@ -854,6 +854,7 @@
    char *name;
    int nlevels;
    char *srs;
+   apr_array_header_t *srs_aliases;
    double extent[4];
    geocache_unit unit;
    int tile_sx, tile_sy; /**<width and height of a tile in pixels */

Modified: trunk/mapserver/mapcache/src/configuration.c
===================================================================
--- trunk/mapserver/mapcache/src/configuration.c	2011-08-26 11:17:27 UTC (rev 12331)
+++ trunk/mapserver/mapcache/src/configuration.c	2011-08-26 11:17:33 UTC (rev 12332)
@@ -121,6 +121,7 @@
    grid = geocache_grid_create(pool);
    grid->name = apr_pstrdup(pool,"GoogleMapsCompatible");
    grid->srs = apr_pstrdup(pool,"epsg:3857");
+   APR_ARRAY_PUSH(grid->srs_aliases,char*) = apr_pstrdup(pool,"epsg:900913");
    apr_table_add(grid->metadata,"title","GoogleMapsCompatible");
    apr_table_add(grid->metadata,"profile","global-mercator");
    apr_table_add(grid->metadata,"wellKnownScaleSet","urn:ogc:def:wkss:OGC:1.0:GoogleMapsCompatible");
@@ -140,28 +141,6 @@
    }
    geocache_configuration_add_grid(cfg,grid,"GoogleMapsCompatible");
 
-   grid = geocache_grid_create(pool);
-   grid->name = apr_pstrdup(pool,"google");
-   grid->srs = apr_pstrdup(pool,"epsg:900913");
-   apr_table_add(grid->metadata,"profile","global-mercator");
-   apr_table_add(grid->metadata,"title","GoogleMapsCompatible");
-   apr_table_add(grid->metadata,"wellKnownScaleSet","urn:ogc:def:wkss:OGC:1.0:GoogleMapsCompatible");
-   grid->tile_sx = grid->tile_sy = 256;
-   grid->nlevels = 19;
-   grid->extent[0] = google_extent[0];
-   grid->extent[1] = google_extent[1];
-   grid->extent[2] = google_extent[2];
-   grid->extent[3] = google_extent[3];
-   grid->unit = GEOCACHE_UNIT_METERS;
-   grid->levels = (geocache_grid_level**)apr_pcalloc(pool,
-         grid->nlevels*sizeof(geocache_grid_level*));
-   for(i=0; i<grid->nlevels; i++) {
-      geocache_grid_level *level = (geocache_grid_level*)apr_pcalloc(pool,sizeof(geocache_grid_level));
-      level->resolution = google_resolutions[i];
-      grid->levels[i] = level;
-   }
-   geocache_configuration_add_grid(cfg,grid,"google");
-
    return cfg;
 }
 
@@ -323,6 +302,11 @@
    if ((cur_node = ezxml_child(node,"srs")) != NULL) {
       grid->srs = apr_pstrdup(ctx->pool,cur_node->txt);
    }
+   
+   for(cur_node = ezxml_child(node,"srsalias"); cur_node; cur_node = cur_node->next) {
+      value = apr_pstrdup(ctx->pool,cur_node->txt);
+      APR_ARRAY_PUSH(grid->srs_aliases,char*) = value;
+   }
 
    if ((cur_node = ezxml_child(node,"size")) != NULL) {
       value = apr_pstrdup(ctx->pool,cur_node->txt);

Modified: trunk/mapserver/mapcache/src/grid.c
===================================================================
--- trunk/mapserver/mapcache/src/grid.c	2011-08-26 11:17:27 UTC (rev 12331)
+++ trunk/mapserver/mapcache/src/grid.c	2011-08-26 11:17:33 UTC (rev 12332)
@@ -23,6 +23,7 @@
 geocache_grid* geocache_grid_create(apr_pool_t *pool) {
    geocache_grid* grid = (geocache_grid*)apr_pcalloc(pool, sizeof(geocache_grid));
    grid->metadata = apr_table_make(pool,3);
+   grid->srs_aliases = apr_array_make(pool,0,sizeof(char*));
    return grid;
 }
 

Modified: trunk/mapserver/mapcache/src/service_wms.c
===================================================================
--- trunk/mapserver/mapcache/src/service_wms.c	2011-08-26 11:17:27 UTC (rev 12331)
+++ trunk/mapserver/mapcache/src/service_wms.c	2011-08-26 11:17:33 UTC (rev 12332)
@@ -347,7 +347,17 @@
             geocache_grid_link *grid_link = NULL;
             for(i=0;i<tileset->grid_links->nelts;i++){
                geocache_grid_link *sgrid = APR_ARRAY_IDX(tileset->grid_links,i,geocache_grid_link*);
-               if(strcasecmp(sgrid->grid->srs,srs)) continue;
+               /* look for a grid with a matching srs */
+               if(strcasecmp(sgrid->grid->srs,srs)) {
+                  /* look if the grid has some srs aliases */
+                  int s;
+                  for(s=0;s<sgrid->grid->srs_aliases->nelts;s++) {
+                     char *srsalias = APR_ARRAY_IDX(sgrid->grid->srs_aliases,s,char*);
+                     if(!strcasecmp(srsalias,srs)) break;
+                  }
+                  if(s==sgrid->grid->srs_aliases->nelts)
+                     continue; /* no srs alias matches the requested srs */
+               }
                grid_link = sgrid;
                break;
             }



More information about the mapserver-commits mailing list