[mapserver-commits] r12264 - trunk/mapserver/mapcache/src
svn at osgeo.org
svn at osgeo.org
Fri Aug 26 07:12:06 EDT 2011
Author: tbonfort
Date: 2011-08-26 04:12:06 -0700 (Fri, 26 Aug 2011)
New Revision: 12264
Modified:
trunk/mapserver/mapcache/src/service_wmts.c
Log:
add custom http headers to wms requests
thomas.bonfort | 2011-01-18 11:56:08 +0100 (Tue, 18 Jan 2011)
Modified: trunk/mapserver/mapcache/src/service_wmts.c
===================================================================
--- trunk/mapserver/mapcache/src/service_wmts.c 2011-08-26 11:12:02 UTC (rev 12263)
+++ trunk/mapserver/mapcache/src/service_wmts.c 2011-08-26 11:12:06 UTC (rev 12264)
@@ -112,60 +112,6 @@
onlineresource,onlineresource,onlineresource);
- apr_hash_index_t *grid_index = apr_hash_first(ctx->pool,cfg->grids);
-
- while(grid_index) {
- geocache_grid *grid;
- char *epsgnum;
- const void *key; apr_ssize_t keylen;
- char *matrix;
- int level;
- const char *WellKnownScaleSet;
- apr_hash_this(grid_index,&key,&keylen,(void**)&grid);
-
- /*locate the number after epsg: in the grd srs*/
- epsgnum = strchr(grid->srs,':');
- if(!epsgnum) {
- epsgnum = grid->srs;
- } else {
- epsgnum++;
- }
-
- WellKnownScaleSet = apr_table_get(grid->metadata,"WellKnownScaleSet");
-
- 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);
-
- if(WellKnownScaleSet) {
- caps = apr_psprintf(ctx->pool,"%s"
- " <WellKnownScaleSet>%s</WellKnownScaleSet>\n",
- caps,WellKnownScaleSet);
- }
-
- for(level=0;level<grid->levels;level++) {
- int matrixwidth, matrixheight;
- double scaledenom, unitwidth, unitheight;
- unitwidth = grid->tile_sx * grid->resolutions[level];
- unitheight = grid->tile_sy * grid->resolutions[level];
-
- scaledenom = grid->resolutions[level] * geocache_meters_per_unit[grid->unit] / 0.00028;
- matrixwidth = ceil((grid->extents[level][2]-grid->extents[level][0] - 0.01 * unitwidth)/unitwidth);
- matrixheight = ceil((grid->extents[level][3]-grid->extents[level][1] - 0.01* unitheight)/unitheight);
- matrix = apr_psprintf(ctx->pool,wmts_matrix,
- grid->name, level,
- scaledenom,
- grid->extents[level][0],grid->extents[level][3],
- grid->tile_sx, grid->tile_sy,
- matrixwidth,matrixheight);
- caps = apr_psprintf(ctx->pool,"%s%s",caps,matrix);
- }
- caps = apr_pstrcat(ctx->pool,caps," </TileMatrixSet>\n",NULL);
- grid_index = apr_hash_next(grid_index);
- }
-
apr_hash_index_t *layer_index = apr_hash_first(ctx->pool,cfg->tilesets);
while(layer_index) {
int i;
@@ -233,14 +179,69 @@
" <TileMatrixSetLink>\n"
"%s"
" </TileMatrixSetLink>\n"
- " <ResourceURL format=\"%s\" resourceType=\"tile\"\n"
- " template=\"%s/wmts/1.0.0/%s/default/%s{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.%s\"/>\n"
+ " <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->format->mime_type,onlineresource,
tileset->name, dimensionstemplate,tileset->format->extension);
layer_index = apr_hash_next(layer_index);
}
+
+ apr_hash_index_t *grid_index = apr_hash_first(ctx->pool,cfg->grids);
+
+ while(grid_index) {
+ geocache_grid *grid;
+ char *epsgnum;
+ const void *key; apr_ssize_t keylen;
+ char *matrix;
+ int level;
+ const char *WellKnownScaleSet;
+ apr_hash_this(grid_index,&key,&keylen,(void**)&grid);
+
+ /*locate the number after epsg: in the grd srs*/
+ epsgnum = strchr(grid->srs,':');
+ if(!epsgnum) {
+ epsgnum = grid->srs;
+ } else {
+ epsgnum++;
+ }
+
+ WellKnownScaleSet = apr_table_get(grid->metadata,"WellKnownScaleSet");
+
+ 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);
+
+ if(WellKnownScaleSet) {
+ caps = apr_psprintf(ctx->pool,"%s"
+ " <WellKnownScaleSet>%s</WellKnownScaleSet>\n",
+ caps,WellKnownScaleSet);
+ }
+
+ for(level=0;level<grid->levels;level++) {
+ int matrixwidth, matrixheight;
+ double scaledenom, unitwidth, unitheight;
+ unitwidth = grid->tile_sx * grid->resolutions[level];
+ unitheight = grid->tile_sy * grid->resolutions[level];
+
+ scaledenom = grid->resolutions[level] * geocache_meters_per_unit[grid->unit] / 0.00028;
+ matrixwidth = ceil((grid->extents[level][2]-grid->extents[level][0] - 0.01 * unitwidth)/unitwidth);
+ matrixheight = ceil((grid->extents[level][3]-grid->extents[level][1] - 0.01* unitheight)/unitheight);
+ matrix = apr_psprintf(ctx->pool,wmts_matrix,
+ grid->name, level,
+ scaledenom,
+ grid->extents[level][0],grid->extents[level][3],
+ grid->tile_sx, grid->tile_sy,
+ matrixwidth,matrixheight);
+ caps = apr_psprintf(ctx->pool,"%s%s",caps,matrix);
+ }
+ caps = apr_pstrcat(ctx->pool,caps," </TileMatrixSet>\n",NULL);
+ grid_index = apr_hash_next(grid_index);
+ }
+
caps = apr_pstrcat(ctx->pool,caps,"</Contents>\n</Capabilities>\n",NULL);
request->request.capabilities = caps;
}
More information about the mapserver-commits
mailing list