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

svn at osgeo.org svn at osgeo.org
Fri Aug 26 07:18:14 EDT 2011


Author: tbonfort
Date: 2011-08-26 04:18:14 -0700 (Fri, 26 Aug 2011)
New Revision: 12341

Modified:
   trunk/mapserver/mapcache/src/geocache_seed.c
   trunk/mapserver/mapcache/src/service_demo.c
Log:
fix some incorrect xml generation for wmts capabilities
thomas.bonfort | 2011-03-27 17:28:49 +0200 (Sun, 27 Mar 2011)

Modified: trunk/mapserver/mapcache/src/geocache_seed.c
===================================================================
--- trunk/mapserver/mapcache/src/geocache_seed.c	2011-08-26 11:18:09 UTC (rev 12340)
+++ trunk/mapserver/mapcache/src/geocache_seed.c	2011-08-26 11:18:14 UTC (rev 12341)
@@ -90,17 +90,19 @@
    geocache_metatile *mt = geocache_tileset_metatile_get(ctx,tile);
    OGRGeometryH mtbboxls = OGR_G_CreateGeometry(wkbLinearRing);
    double *e = mt->map.extent;
-   OGR_G_AddPoint_2D(mtbboxls,e[0],e[1]);
-   OGR_G_AddPoint_2D(mtbboxls,e[2],e[1]);
-   OGR_G_AddPoint_2D(mtbboxls,e[2],e[3]);
-   OGR_G_AddPoint_2D(mtbboxls,e[0],e[3]);
-   OGR_G_AddPoint_2D(mtbboxls,e[0],e[1]);
+   OGR_G_SetPoint_2D(mtbboxls,0,e[0],e[1]);
+   OGR_G_SetPoint_2D(mtbboxls,1,e[2],e[1]);
+   OGR_G_SetPoint_2D(mtbboxls,2,e[2],e[3]);
+   OGR_G_SetPoint_2D(mtbboxls,3,e[0],e[3]);
+   OGR_G_SetPoint_2D(mtbboxls,4,e[0],e[1]);
    OGRGeometryH mtbbox = OGR_G_CreateGeometry(wkbPolygon);
    OGR_G_AddGeometryDirectly(mtbbox,mtbboxls);
    int i;
    for(i=0;i<nClippers;i++) {
       OGRGeometryH clipper = clippers[i];
-      if(OGR_G_Intersection(mtbbox,clipper))
+      OGRGeometryH clipresult;
+      clipresult = OGR_G_Intersection(mtbbox,clipper);
+      if(clipresult && !OGR_G_IsEmpty(clipresult))
          return 1;
    }
    return 0;
@@ -144,6 +146,9 @@
        }
     }
 
+    if(!should_seed)
+       return 0;
+
     /* if here, the tile does not exist */
 #ifdef USE_OGR
     /* check we are in the requested features before deleting the tile */
@@ -188,9 +193,9 @@
 
     while(1) {
         ctx->nextx += ctx->tileset->metasize_x;
-        if(ctx->nextx >= tile->grid_link->grid_limits[ctx->nextz][2]) {
+        if(ctx->nextx > tile->grid_link->grid_limits[ctx->nextz][2]+ctx->tileset->metasize_x) {
             ctx->nexty += ctx->tileset->metasize_y;
-            if(ctx->nexty >= tile->grid_link->grid_limits[ctx->nextz][3]) {
+            if(ctx->nexty >= tile->grid_link->grid_limits[ctx->nextz][3]+ctx->tileset->metasize_y) {
                 ctx->nextz += 1;
                 if(ctx->nextz > ctx->maxzoom) break;
                 ctx->nexty = tile->grid_link->grid_limits[ctx->nextz][1];
@@ -336,6 +341,7 @@
     geocache_context_init(gctx);
     cfg = geocache_configuration_create(gctx->pool);
     gctx->config = cfg;
+    gctx->log= geocache_context_seeding_log;
     apr_getopt_init(&opt, gctx->pool, argc, argv);
     
     curz=-1;
@@ -453,27 +459,38 @@
       if((nClippers=OGR_L_GetFeatureCount(layer, TRUE)) == 0) {
          return usage(argv[0],"no features in provided ogr parameters, cannot continue");
       }
-      OGREnvelope ogr_extent;
 
-      OGR_L_GetExtent(layer,&ogr_extent,TRUE);
-      extent = apr_pcalloc(gctx->pool,4*sizeof(double));
-      extent[0] = ogr_extent.MinX;
-      extent[1] = ogr_extent.MinY;
-      extent[2] = ogr_extent.MaxX;
-      extent[3] = ogr_extent.MaxY;
 
-
       clippers = (OGRGeometryH*)malloc(nClippers*sizeof(OGRGeometryH));
 
 
       OGRFeatureH hFeature;
 
       OGR_L_ResetReading(layer);
+      extent = apr_pcalloc(gctx->pool,4*sizeof(double));
       int f=0;
       while( (hFeature = OGR_L_GetNextFeature(layer)) != NULL ) {
-         clippers[f] = OGR_F_StealGeometry(hFeature);
+         clippers[f] = OGR_G_Clone(OGR_F_GetGeometryRef(hFeature));
+         OGREnvelope ogr_extent;
+         OGR_G_GetEnvelope	(clippers[f], &ogr_extent);	
+         if(f == 0) {
+            extent[0] = ogr_extent.MinX;
+            extent[1] = ogr_extent.MinY;
+            extent[2] = ogr_extent.MaxX;
+            extent[3] = ogr_extent.MaxY;
+         } else {
+            extent[0] = GEOCACHE_MIN(ogr_extent.MinX, extent[0]);
+            extent[1] = GEOCACHE_MIN(ogr_extent.MinY, extent[1]);
+            extent[2] = GEOCACHE_MAX(ogr_extent.MaxX, extent[2]);
+            extent[3] = GEOCACHE_MAX(ogr_extent.MaxY, extent[3]);
+         }
+
          OGR_F_Destroy( hFeature );
+         f++;
       }
+      if(f != nClippers) {
+         usage(argv[0],"error");
+      }
       
 
     }

Modified: trunk/mapserver/mapcache/src/service_demo.c
===================================================================
--- trunk/mapserver/mapcache/src/service_demo.c	2011-08-26 11:18:09 UTC (rev 12340)
+++ trunk/mapserver/mapcache/src/service_demo.c	2011-08-26 11:18:14 UTC (rev 12341)
@@ -40,7 +40,7 @@
 static char *demo_layer =
       "    var %s_%s_layer = new OpenLayers.Layer.WMS( \"%s-%s\",\n"
       "        \"%s\",{layers: '%s'},\n"
-      "        { gutter:0,ratio:1,isBaseLayer:true,transitionEffect:'resize',\n"
+      "        { gutter:0,buffer:0,isBaseLayer:true,transitionEffect:'resize',\n"
       "          resolutions:[%s],\n"
       "          maxExtent: new OpenLayers.Bounds(%f,%f,%f,%f),\n"
       "          projection: new OpenLayers.Projection(\"%s\")\n"



More information about the mapserver-commits mailing list