[mapserver-commits] r12357 - trunk/mapserver/mapcache/src

svn at osgeo.org svn at osgeo.org
Fri Aug 26 07:19:24 EDT 2011


Author: tbonfort
Date: 2011-08-26 04:19:23 -0700 (Fri, 26 Aug 2011)
New Revision: 12357

Modified:
   trunk/mapserver/mapcache/src/configuration.c
   trunk/mapserver/mapcache/src/grid.c
   trunk/mapserver/mapcache/src/service_demo.c
Log:
fix tms tileset href

closes issue 75.
thomas.bonfort | 2011-05-01 17:04:27 +0200 (Sun, 01 May 2011)

Modified: trunk/mapserver/mapcache/src/configuration.c
===================================================================
--- trunk/mapserver/mapcache/src/configuration.c	2011-08-26 11:19:18 UTC (rev 12356)
+++ trunk/mapserver/mapcache/src/configuration.c	2011-08-26 11:19:23 UTC (rev 12357)
@@ -299,6 +299,19 @@
       GC_CHECK_ERROR(ctx);
    } 
 
+   if ((cur_node = ezxml_child(node,"units")) != NULL) {
+      if(!strcasecmp(cur_node->txt,"dd")) {
+         grid->unit = GEOCACHE_UNIT_DEGREES;
+      } else if(!strcasecmp(cur_node->txt,"m")) {
+         grid->unit = GEOCACHE_UNIT_METERS;
+      } else if(!strcasecmp(cur_node->txt,"ft")) {
+         grid->unit = GEOCACHE_UNIT_FEET;
+      } else {
+         ctx->set_error(ctx, 400, "unknown unit %s for grid %s (valid values are \"dd\", \"m\", and \"ft\"",
+               cur_node->txt, grid->name);
+         return;
+      }
+   }
    if ((cur_node = ezxml_child(node,"srs")) != NULL) {
       grid->srs = apr_pstrdup(ctx->pool,cur_node->txt);
    }

Modified: trunk/mapserver/mapcache/src/grid.c
===================================================================
--- trunk/mapserver/mapcache/src/grid.c	2011-08-26 11:19:18 UTC (rev 12356)
+++ trunk/mapserver/mapcache/src/grid.c	2011-08-26 11:19:23 UTC (rev 12357)
@@ -24,6 +24,7 @@
    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*));
+   grid->unit = GEOCACHE_UNIT_METERS;
    return grid;
 }
 

Modified: trunk/mapserver/mapcache/src/service_demo.c
===================================================================
--- trunk/mapserver/mapcache/src/service_demo.c	2011-08-26 11:19:18 UTC (rev 12356)
+++ trunk/mapserver/mapcache/src/service_demo.c	2011-08-26 11:19:23 UTC (rev 12357)
@@ -42,6 +42,7 @@
       "        \"%s\",{layers: '%s'},\n"
       "        { gutter:0,buffer:0,isBaseLayer:true,transitionEffect:'resize',\n"
       "          resolutions:[%s],\n"
+      "          units:\"%s\",\n"
       "          maxExtent: new OpenLayers.Bounds(%f,%f,%f,%f),\n"
       "          projection: new OpenLayers.Projection(\"%s\")\n"
       "        }\n"
@@ -52,6 +53,7 @@
       "        \"%s\",{layers: '%s'},\n"
       "        { gutter:0,ratio:1,isBaseLayer:true,transitionEffect:'resize',\n"
       "          resolutions:[%s],\n"
+      "          units:\"%s\",\n"
       "          singleTile:true,\n"
       "          maxExtent: new OpenLayers.Bounds(%f,%f,%f,%f),\n"
       "          projection: new OpenLayers.Projection(\"%s\")\n"
@@ -88,9 +90,16 @@
       int i,j;
       for(j=0;j<tileset->grid_links->nelts;j++) {
          char *resolutions="";
+         char *unit="dd";
          geocache_grid *grid = APR_ARRAY_IDX(tileset->grid_links,j,geocache_grid_link*)->grid;
+         if(grid->unit == GEOCACHE_UNIT_METERS) {
+            unit="m";
+         } else if(grid->unit == GEOCACHE_UNIT_FEET) {
+            unit="ft";
+         }
          layers = apr_psprintf(ctx->pool,"%s,%s_%s_layer",layers,tileset->name,grid->name);
          resolutions = apr_psprintf(ctx->pool,"%s%.20f",resolutions,grid->levels[0]->resolution);
+         
          for(i=1;i<grid->nlevels;i++) {
             resolutions = apr_psprintf(ctx->pool,"%s,%.20f",resolutions,grid->levels[i]->resolution);
          }
@@ -100,7 +109,7 @@
                tileset->name,
                grid->name,
                apr_pstrcat(ctx->pool,onlineresource,"/wms?",NULL),
-               tileset->name,resolutions,
+               tileset->name,resolutions,unit,
                grid->extent[0],
                grid->extent[1],
                grid->extent[2],
@@ -116,7 +125,7 @@
                tileset->name,
                grid->name,
                apr_pstrcat(ctx->pool,onlineresource,"/wms?",NULL),
-               tileset->name,resolutions,
+               tileset->name,resolutions,unit,
                grid->extent[0],
                grid->extent[1],
                grid->extent[2],



More information about the mapserver-commits mailing list