[mapserver-commits] r12268 - in trunk/mapserver/mapcache: include
src
svn at osgeo.org
svn at osgeo.org
Fri Aug 26 07:12:29 EDT 2011
Author: tbonfort
Date: 2011-08-26 04:12:29 -0700 (Fri, 26 Aug 2011)
New Revision: 12268
Modified:
trunk/mapserver/mapcache/include/geocache.h
trunk/mapserver/mapcache/src/configuration.c
trunk/mapserver/mapcache/src/grid.c
trunk/mapserver/mapcache/src/service_wmts.c
Log:
use dimensions and grid in semaphore name.
this is untested on platforms where semaphores have limited name lengths
fixes issue 32.
thomas.bonfort | 2011-01-18 15:16:45 +0100 (Tue, 18 Jan 2011)
Modified: trunk/mapserver/mapcache/include/geocache.h
===================================================================
--- trunk/mapserver/mapcache/include/geocache.h 2011-08-26 11:12:23 UTC (rev 12267)
+++ trunk/mapserver/mapcache/include/geocache.h 2011-08-26 11:12:29 UTC (rev 12268)
@@ -717,6 +717,7 @@
*
* a request is valid if x is in [minTileX, maxTileX[ and y in [minTileY,maxTileY]
*/
+ double *restricted_extent;
int **grid_limits;
};
@@ -880,6 +881,9 @@
/* in grid.c */
geocache_grid* geocache_grid_create(apr_pool_t *pool);
+const char* geocache_grid_get_crs(geocache_context *ctx, geocache_grid *grid);
+const char* geocache_grid_get_srs(geocache_context *ctx, geocache_grid *grid);
+
/**
* \brief compute x y value for given lon/lat (dx/dy) and given zoomlevel
* @param ctx
Modified: trunk/mapserver/mapcache/src/configuration.c
===================================================================
--- trunk/mapserver/mapcache/src/configuration.c 2011-08-26 11:12:23 UTC (rev 12267)
+++ trunk/mapserver/mapcache/src/configuration.c 2011-08-26 11:12:29 UTC (rev 12268)
@@ -590,10 +590,9 @@
}
restrictedExtent = (char*)ezxml_attr(cur_node,"restricted_extent");
if(restrictedExtent) {
- double *extent;
int nvalues;
restrictedExtent = apr_pstrdup(ctx->pool,restrictedExtent);
- if(GEOCACHE_SUCCESS != geocache_util_extract_double_list(ctx, restrictedExtent, ' ', &extent, &nvalues) ||
+ if(GEOCACHE_SUCCESS != geocache_util_extract_double_list(ctx, restrictedExtent, ' ', &gridlink->restricted_extent, &nvalues) ||
nvalues != 4) {
ctx->set_error(ctx, GEOCACHE_PARSE_ERROR, "failed to parse extent array %s."
"(expecting 4 space separated numbers, "
@@ -601,7 +600,7 @@
restrictedExtent);
return;
}
- geocache_grid_compute_limits(grid,extent,gridlink->grid_limits);
+ geocache_grid_compute_limits(grid,gridlink->restricted_extent,gridlink->grid_limits);
} else {
geocache_grid_compute_limits(grid,grid->extent,gridlink->grid_limits);
Modified: trunk/mapserver/mapcache/src/grid.c
===================================================================
--- trunk/mapserver/mapcache/src/grid.c 2011-08-26 11:12:23 UTC (rev 12267)
+++ trunk/mapserver/mapcache/src/grid.c 2011-08-26 11:12:29 UTC (rev 12268)
@@ -25,6 +25,23 @@
return grid;
}
+const char* geocache_grid_get_crs(geocache_context *ctx, geocache_grid *grid) {
+ char *epsgnum;
+
+ /*locate the number after epsg: in the grd srs*/
+ epsgnum = strchr(grid->srs,':');
+ if(!epsgnum) {
+ epsgnum = grid->srs;
+ } else {
+ epsgnum++;
+ }
+
+ return apr_psprintf(ctx->pool,"urn:ogc:def:crs:EPSG::%s",epsgnum);
+}
+
+const char* geocache_grid_get_srs(geocache_context *ctx, geocache_grid *grid) {
+ return (const char*)grid->srs;
+}
void geocache_grid_compute_limits(const geocache_grid *grid, const double *extent, int **limits) {
int i;
double epsilon = 0.0000001;
Modified: trunk/mapserver/mapcache/src/service_wmts.c
===================================================================
--- trunk/mapserver/mapcache/src/service_wmts.c 2011-08-26 11:12:23 UTC (rev 12267)
+++ trunk/mapserver/mapcache/src/service_wmts.c 2011-08-26 11:12:29 UTC (rev 12268)
@@ -153,36 +153,70 @@
dimensionstemplate = apr_pstrcat(ctx->pool,dimensionstemplate,"{",dimension->name,"}/",NULL);
}
}
- char *tmsets="";
+ char *tmsets = "";
+ char *bboxes = "";
for(i=0;i<tileset->grid_links->nelts;i++) {
+ char *matrixlimits = "";
geocache_grid_link *grid_link = APR_ARRAY_IDX(tileset->grid_links,i,geocache_grid_link*);
+ if(grid_link->restricted_extent) {
+ int j;
+ matrixlimits = " <TileMatrixSetLimits>";
+ for(j=0;j<grid_link->grid->nlevels;j++) {
+ matrixlimits = apr_psprintf(ctx->pool,"%s\n"
+ " <TileMatrixLimits>\n"
+ " <TileMatrix>%s:%d</TileMatrix>\n"
+ " <MinTileRow>%d</MinTileRow>\n"
+ " <MaxTileRow>%d</MaxTileRow>\n"
+ " <MinTileCol>%d</MinTileCol>\n"
+ " <MaxTileCol>%d</MaxTileCol>\n"
+ " </TileMatrixLimits>",
+ matrixlimits,
+ grid_link->grid->name,j,
+ grid_link->grid_limits[j][0],
+ grid_link->grid_limits[j][2]-1,
+ grid_link->grid_limits[j][1],
+ grid_link->grid_limits[j][3]-1);
+
+ }
+ matrixlimits = apr_pstrcat(ctx->pool,matrixlimits,"\n </TileMatrixSetLimits>\n",NULL);
+ }
tmsets = apr_pstrcat(ctx->pool,tmsets,
+ " <TileMatrixSetLink>\n"
" <TileMatrixSet>",
grid_link->grid->name,
"</TileMatrixSet>\n",
+ matrixlimits,
+ " </TileMatrixSetLink>\n",
NULL);
+
+ double *bbox = grid_link->restricted_extent?grid_link->restricted_extent:grid_link->grid->extent;
+ bboxes = apr_psprintf(ctx->pool,"%s"
+ " <ows:BoundingBox>\n"
+ " <ows:CRS>%s</ows:CRS>\n"
+ " <ows:LowerCorner>%f %f</ows:Lowercorner>\n"
+ " <ows:Uppercorner>%f %f</ows:UpperCorner>\n"
+ " <ows:BoundingBox>\n",
+ bboxes,
+ geocache_grid_get_crs(ctx,grid_link->grid),
+ bbox[0],bbox[1],
+ bbox[2],bbox[3]);
}
caps = apr_psprintf(ctx->pool,"%s"
" <Layer>\n"
" <ows:Title>%s</ows:Title>\n"
" <ows:Abstract>%s</ows:Abstract>\n"
- /*" <ows:WGS84BoundingBox>\n"
- " <ows:LowerCorner>%f %f</ows:LowerCorner>\n"
- " <ows:UpperCorner>%f %f</ows:UpperCorner>\n"
- " </ows:WGS84BoundingBox>\n"*/
" <ows:Identifier>%s</ows:Identifier>\n"
" <Style isDefault=\"true\">\n"
" <ows:Identifier>default</ows:Identifier>\n"
" </Style>\n"
"%s" /*dimensions*/
" <Format>%s</Format>\n"
- " <TileMatrixSetLink>\n"
- "%s"
- " </TileMatrixSetLink>\n"
+ "%s" /*TileMatrixsetLinks*/
+ "%s" /*BoundinBoxes*/
" <ResourceURL format=\"%s\" resourceType=\"tile\""
" template=\"%s/wmts/1.0.0/%s/default/%s{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.%s\"/>\n"
" </Layer>\n",caps,title,abstract,
- tileset->name,dimensions,tileset->format->mime_type,tmsets,
+ tileset->name,dimensions,tileset->format->mime_type,tmsets,bboxes,
tileset->format->mime_type,onlineresource,
tileset->name, dimensionstemplate,tileset->format->extension);
layer_index = apr_hash_next(layer_index);
@@ -212,8 +246,8 @@
caps = apr_psprintf(ctx->pool,"%s"
" <TileMatrixSet>\n"
" <ows:Identifier>%s</ows:Identifier>\n"
- " <ows:SupportedCRS>urn:ogc:def:crs:EPSG::%s</ows:SupportedCRS>\n",
- caps,grid->name,epsgnum);
+ " <ows:SupportedCRS>%s</ows:SupportedCRS>\n",
+ caps,grid->name,geocache_grid_get_crs(ctx,grid));
if(WellKnownScaleSet) {
caps = apr_psprintf(ctx->pool,"%s"
More information about the mapserver-commits
mailing list