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

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


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

Modified:
   trunk/mapserver/mapcache/src/geocache_seed.c
Log:
add the "g" default grid with srs epsg:900913, and use it by default on the example tilesets. fixes issue 71.
thomas.bonfort | 2011-03-28 13:44:03 +0200 (Mon, 28 Mar 2011)

Modified: trunk/mapserver/mapcache/src/geocache_seed.c
===================================================================
--- trunk/mapserver/mapcache/src/geocache_seed.c	2011-08-26 11:18:14 UTC (rev 12341)
+++ trunk/mapserver/mapcache/src/geocache_seed.c	2011-08-26 11:18:18 UTC (rev 12342)
@@ -154,12 +154,7 @@
     /* check we are in the requested features before deleting the tile */
     if(nClippers > 0) {
        intersects = ogr_features_intersect_tile(ctx,tile);
-    if(intersects!= 0) {
-      printf("keeping tile\n");
-    } else {
-      printf("skipping tile\n");
     }
-    }
 #endif
     if(intersects!= 0) {
       should_seed = 1;
@@ -193,9 +188,9 @@
 
     while(1) {
         ctx->nextx += ctx->tileset->metasize_x;
-        if(ctx->nextx > tile->grid_link->grid_limits[ctx->nextz][2]+ctx->tileset->metasize_x) {
+        if(ctx->nextx > tile->grid_link->grid_limits[ctx->nextz][2]) {
             ctx->nexty += ctx->tileset->metasize_y;
-            if(ctx->nexty >= tile->grid_link->grid_limits[ctx->nextz][3]+ctx->tileset->metasize_y) {
+            if(ctx->nexty >= tile->grid_link->grid_limits[ctx->nextz][3]) {
                 ctx->nextz += 1;
                 if(ctx->nextz > ctx->maxzoom) break;
                 ctx->nexty = tile->grid_link->grid_limits[ctx->nextz][1];
@@ -270,7 +265,7 @@
         seededtilestot+=tile->tileset->metasize_x*tile->tileset->metasize_y;
         time_t now = time(NULL);
         if(now-lastlogtime>5) {
-           printf("\t\t\t\t\t\t\t\t\t\t\t\rseeding level %d at %g tiles/sec (avg:%.2f)\r",tile->z,
+           printf("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\rseeding level %d at %.2f tiles/sec (avg:%.2f)\r",tile->z,
                  seededtiles/((double)(now-lastlogtime)),
                  seededtilestot/((double)(now-starttime)));
            fflush(NULL);
@@ -546,6 +541,18 @@
        // update the grid limits
        geocache_grid_compute_limits(grid_link->grid,extent,grid_link->grid_limits);
     }
+
+    /* adjust our grid limits so they align on the metatile limits
+     * we need to do this because the seeder does not check for individual tiles, it
+     * goes from one metatile to the next*/
+
+    for(n=0;n<grid_link->grid->nlevels;n++) {
+      grid_link->grid_limits[n][0] = (grid_link->grid_limits[n][0]/tileset->metasize_x)*tileset->metasize_x;
+      grid_link->grid_limits[n][1] = (grid_link->grid_limits[n][1]/tileset->metasize_y)*tileset->metasize_y;
+      grid_link->grid_limits[n][2] = (grid_link->grid_limits[n][2]/tileset->metasize_x+1)*tileset->metasize_x;
+      grid_link->grid_limits[n][3] = (grid_link->grid_limits[n][3]/tileset->metasize_y+1)*tileset->metasize_y;
+    }
+
     ctx.nextz = zooms[0];
     ctx.nextx = grid_link->grid_limits[zooms[0]][0];
     ctx.nexty = grid_link->grid_limits[zooms[0]][1];



More information about the mapserver-commits mailing list