[mapserver-commits] r12318 - in trunk/mapserver/mapcache: . include
src
svn at osgeo.org
svn at osgeo.org
Fri Aug 26 07:16:35 EDT 2011
Author: tbonfort
Date: 2011-08-26 04:16:35 -0700 (Fri, 26 Aug 2011)
New Revision: 12318
Modified:
trunk/mapserver/mapcache/geocache.xml
trunk/mapserver/mapcache/include/geocache.h
trunk/mapserver/mapcache/src/configuration.c
trunk/mapserver/mapcache/src/core.c
Log:
dont create base directory if it doesnt exist.
closes issue 56.
thomas.bonfort | 2011-03-01 12:01:06 +0100 (Tue, 01 Mar 2011)
Modified: trunk/mapserver/mapcache/geocache.xml
===================================================================
--- trunk/mapserver/mapcache/geocache.xml 2011-08-26 11:16:29 UTC (rev 12317)
+++ trunk/mapserver/mapcache/geocache.xml 2011-08-26 11:16:35 UTC (rev 12318)
@@ -4,9 +4,13 @@
<title>my geocache service</title>
<abstract>woot! this is a service abstract!</abstract>
- <!--
+ <!-- url
+
uncomment and modify this if you need to provide another base url for
- getCapabilities requests (for the OnlineResource tags)
+ getCapabilities requests (for the OnlineResource tags). You should use
+ this if there's a proxy between the client and the mod-geocache service
+ and you want the capabilities document to point to the correct endpoints.
+
<url>http://mysuperhost/proxy/to/geocache</url>
-->
</metadata>
@@ -88,7 +92,7 @@
<title>GoogleMapsCompatible</title>
<WellKnownScaleSet>urn:ogc:def:wkss:OGC:1.0:GoogleMapsCompatible</WellKnownScaleSet>
</metadata>
- <extent>-20037508.34,-20037508.34,20037508.34,20037508.34</extent>
+ <extent>-20037508.3427892480,-20037508.3427892480,20037508.3427892480,20037508.3427892480</extent>
<srs>epsg:900913</srs>
<size>256 256</size>
<resolutions>
@@ -120,7 +124,7 @@
<title>GoogleMapsCompatible</title>
<WellKnownScaleSet>urn:ogc:def:wkss:OGC:1.0:GoogleMapsCompatible</WellKnownScaleSet>
</metadata>
- <extent>-20037508.34,-20037508.34,20037508.34,20037508.34</extent>
+ <extent>-20037508.3427892480,-20037508.3427892480,20037508.3427892480,20037508.3427892480</extent>
<srs>epsg:3857</srs>
<size>256 256</size>
<resolutions>
@@ -238,7 +242,7 @@
-->
<url>http://vmap0.tiles.osgeo.org/wms/vmap0</url>
- <!-- wmsparams
+ <!-- getmap
extra parameters that will be added to the GetMap request. you can specify any
parameter here, e.g. VERSION if you want to override the version of the WMS
@@ -315,8 +319,18 @@
<TRANSPARENT>true</TRANSPARENT>
</params>
</getmap>
+
+ <!-- getfeatureinfo
+ additional parameters to use if you want to enable proxying GetFeatureInfo requests
+ to this source
+ -->
<getfeatureinfo>
+ <!-- info_formats: comma separated list of wms info_formats supported by the source WMS.
+ you can get this list by studying the source WMS capabilities document.
+ -->
<info_formats>text/plain,application/vnd.ogc.gml</info_formats>
+
+ <!-- KVP params to pass with the request. QUERY_LAYERS is mandatory -->
<params>
<QUERY_LAYERS>GRAVI_BASE</QUERY_LAYERS>
</params>
@@ -507,8 +521,10 @@
<!-- OSGEO TMS -->
<tms>true</tms>
+ <!-- Virtualearth/Bing quadkey-->
<ve>true</ve>
-
+
+ <!-- kml superoverlays -->
<kml>true</kml>
<!-- OGC WMTS -->
@@ -534,4 +550,18 @@
if you're paranoid, or to "empty_img" if you want to play nice with non-conforming clients.
-->
<errors>report</errors>
+
+ <!-- full_wms
+ configure response to wms requests that are not aligned to a tileset's grids.
+ responding to requests that are not in the SRS of a configured grid is not supported, but
+ this should never happen as only the supported SRSs are publicized in the capabilities
+ document.
+
+ allowed values are:
+ - error: return a 404 error (default)
+ - assemble: build the full image by assembling the tiles from the cache
+ - forward: forward the request to the configured source.
+ -->
+ <full_wms>forward</full_wms>
+
</geocache>
Modified: trunk/mapserver/mapcache/include/geocache.h
===================================================================
--- trunk/mapserver/mapcache/include/geocache.h 2011-08-26 11:16:29 UTC (rev 12317)
+++ trunk/mapserver/mapcache/include/geocache.h 2011-08-26 11:16:35 UTC (rev 12318)
@@ -690,6 +690,12 @@
char *mutex_name;
};
+typedef enum {
+ GEOCACHE_GETMAP_ERROR,
+ GEOCACHE_GETMAP_ASSEMBLE,
+ GEOCACHE_GETMAP_FORWARD
+} geocache_getmap_strategy;
+
/**
* a configuration that will be served
*/
@@ -732,12 +738,19 @@
geocache_image_format *merge_format;
/**
- * how should error messages be reported to the user
- */
- geocache_error_reporting reporting;
- geocache_buffer *empty_image;
-
- apr_table_t *metadata;
+ * how should error messages be reported to the user
+ */
+ geocache_error_reporting reporting;
+
+ /**
+ * encoded empty (tranpsarent) image that will be returned to clients if cofigured
+ * to return blank images upon error
+ */
+ geocache_buffer *empty_image;
+
+ geocache_getmap_strategy getmap_strategy;
+
+ apr_table_t *metadata;
};
/**
Modified: trunk/mapserver/mapcache/src/configuration.c
===================================================================
--- trunk/mapserver/mapcache/src/configuration.c 2011-08-26 11:16:29 UTC (rev 12317)
+++ trunk/mapserver/mapcache/src/configuration.c 2011-08-26 11:16:35 UTC (rev 12318)
@@ -975,6 +975,17 @@
}
}
+ config->getmap_strategy = GEOCACHE_GETMAP_ERROR;
+ if ((node = ezxml_child(doc,"full_wms")) != NULL) {
+ if(!strcmp(node->txt,"assemble")) {
+ config->getmap_strategy = GEOCACHE_GETMAP_ASSEMBLE;
+ } else if(!strcmp(node->txt,"forward")) {
+ config->getmap_strategy = GEOCACHE_GETMAP_FORWARD;
+ } else if(*node->txt && strcmp(node->txt,"error")) {
+ ctx->set_error(ctx,400, "unknown value %s for node <full_wms> (allowed values: assemble, getmap or error", node->txt);
+ goto cleanup;
+ }
+ }
cleanup:
Modified: trunk/mapserver/mapcache/src/core.c
===================================================================
--- trunk/mapserver/mapcache/src/core.c 2011-08-26 11:16:29 UTC (rev 12317)
+++ trunk/mapserver/mapcache/src/core.c 2011-08-26 11:16:35 UTC (rev 12318)
@@ -57,32 +57,57 @@
}
geocache_map *geocache_core_get_map(geocache_context *ctx, geocache_request_get_map *req_map) {
-#ifdef USE_CAIRO
#ifdef DEBUG
if(req_map->nmaps ==0) {
ctx->set_error(ctx,500,"BUG: get_map called with 0 maps");
return NULL;
}
#endif
- int i;
- geocache_map *basemap = req_map->maps[0];
- geocache_image *baseim = _core_get_single_map(ctx,basemap);
- if(GC_HAS_ERROR(ctx)) return NULL;
- for(i=1;i<req_map->nmaps;i++) {
- geocache_map *overlaymap = req_map->maps[i];
- geocache_image *overlayim = _core_get_single_map(ctx,overlaymap);
+
+ if(ctx->config->getmap_strategy == GEOCACHE_GETMAP_ERROR) {
+ ctx->set_error(ctx, 404, "full wms support disabled");
+ return NULL;
+ } else if(ctx->config->getmap_strategy == GEOCACHE_GETMAP_ASSEMBLE) {
+#ifdef USE_CAIRO
+ int i;
+ geocache_map *basemap = req_map->maps[0];
+ geocache_image *baseim = _core_get_single_map(ctx,basemap);
if(GC_HAS_ERROR(ctx)) return NULL;
- geocache_image_merge(ctx,baseim,overlayim);
- if(GC_HAS_ERROR(ctx)) return NULL;
- }
+ for(i=1;i<req_map->nmaps;i++) {
+ geocache_map *overlaymap = req_map->maps[i];
+ geocache_image *overlayim = _core_get_single_map(ctx,overlaymap);
+ if(GC_HAS_ERROR(ctx)) return NULL;
+ geocache_image_merge(ctx,baseim,overlayim);
+ if(GC_HAS_ERROR(ctx)) return NULL;
+ }
- geocache_map *getmap = geocache_tileset_map_create(ctx->pool,basemap->tileset, basemap->grid_link);
- getmap->data = basemap->tileset->format->write(ctx,baseim,basemap->tileset->format);
- return getmap;
+ basemap->data = basemap->tileset->format->write(ctx,baseim,basemap->tileset->format);
+ return basemap;
#else
- ctx->set_error(ctx,501,"wms getmap handling not configured in this build");
- return NULL;
+ ctx->set_error(ctx,501,"cairo not enabled: wms getmap handling by assembling tiles not configured in this build");
+ return NULL;
#endif
+ } else /*if(ctx->config->getmap_strategy == GEOCACHE_GETMAP_FORWARD)*/ {
+ int i;
+ geocache_map *basemap = req_map->maps[0];
+ basemap->tileset->source->render_map(ctx, basemap);
+ if(GC_HAS_ERROR(ctx)) return NULL;
+ if(i>1) {
+ geocache_image *baseim = geocache_imageio_decode(ctx,basemap->data);
+ if(GC_HAS_ERROR(ctx)) return NULL;
+ for(i=1;i<req_map->nmaps;i++) {
+ geocache_map *overlaymap = req_map->maps[i];
+ overlaymap->tileset->source->render_map(ctx, overlaymap);
+ if(GC_HAS_ERROR(ctx)) return NULL;
+ geocache_image *overlayim = geocache_imageio_decode(ctx,overlaymap->data);
+ if(GC_HAS_ERROR(ctx)) return NULL;
+ geocache_image_merge(ctx,baseim,overlayim);
+ if(GC_HAS_ERROR(ctx)) return NULL;
+ }
+ basemap->data = basemap->tileset->format->write(ctx,baseim,basemap->tileset->format);
+ }
+ return basemap;
+ }
}
geocache_feature_info *geocache_core_get_featureinfo(geocache_context *ctx,
More information about the mapserver-commits
mailing list