[mapserver-commits] r12210 - in trunk/mapserver/mapcache: . include
src
svn at osgeo.org
svn at osgeo.org
Fri Aug 26 07:07:30 EDT 2011
Author: tbonfort
Date: 2011-08-26 04:07:29 -0700 (Fri, 26 Aug 2011)
New Revision: 12210
Modified:
trunk/mapserver/mapcache/geocache.xml
trunk/mapserver/mapcache/include/geocache.h
trunk/mapserver/mapcache/src/cache_disk.c
trunk/mapserver/mapcache/src/configuration.c
trunk/mapserver/mapcache/src/grid.c
trunk/mapserver/mapcache/src/imageio_jpeg.c
trunk/mapserver/mapcache/src/imageio_png.c
trunk/mapserver/mapcache/src/services.c
trunk/mapserver/mapcache/src/source.c
trunk/mapserver/mapcache/src/tileset.c
Log:
add libtool tag
thomas.bonfort | 2011-01-07 14:30:34 +0100 (Fri, 07 Jan 2011)
Modified: trunk/mapserver/mapcache/geocache.xml
===================================================================
--- trunk/mapserver/mapcache/geocache.xml 2011-08-26 11:07:21 UTC (rev 12209)
+++ trunk/mapserver/mapcache/geocache.xml 2011-08-26 11:07:29 UTC (rev 12210)
@@ -1,6 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<geocache>
+ <metadata>
+ <title>my geocache service</title>
+ <abstract>woot! this is a service abstract!</abstract>
+
+ <!-- uncomment this if you need to provide another base url for
+ getCapabilities requests (for the OnlineResource tags)
+ <url>http://mysuperhost/proxy/to/geocache</url>
+ -->
+ </metadata>
<grid name="testgrid">
+ <metadata>
+ <title>this is a custom grid I made up for an example</title>
+ </metadata>
<srs>epsg:4326</srs>
<size>256 256</size>
<extent>-180 -90 180 90</extent>
@@ -71,6 +83,10 @@
<metabuffer>30</metabuffer>
</tileset>
<tileset name="osm">
+ <metadata>
+ <title>osm mapserver served map of midi-pyrénées</title>
+ <abstract>see http://mapserver-utils.googlecode.com</abstract>
+ </metadata>
<source>osm</source>
<cache>disk</cache>
<format>PNG</format>
Modified: trunk/mapserver/mapcache/include/geocache.h
===================================================================
--- trunk/mapserver/mapcache/include/geocache.h 2011-08-26 11:07:21 UTC (rev 12209)
+++ trunk/mapserver/mapcache/include/geocache.h 2011-08-26 11:07:29 UTC (rev 12210)
@@ -208,6 +208,7 @@
double data_extent[4]; /**< extent in which this source can produce data */
geocache_source_type type;
int supports_metatiling;
+ apr_table_t *metadata;
/**
* \brief get the data for the metatile
*
@@ -257,6 +258,8 @@
struct geocache_cache {
char *name; /**< key this cache is referenced by */
geocache_cache_type type;
+ apr_table_t *metadata;
+
/**
* get tile content from cache
* \returns GEOCACHE_SUCCESS if the data was correctly loaded from the disk
@@ -588,6 +591,8 @@
* how should error messages be reported to the user
*/
geocache_error_reporting reporting;
+
+ apr_table_t *metadata;
};
/**
@@ -679,6 +684,8 @@
int tile_sx, tile_sy; /**<width and height of a tile in pixels */
double *resolutions;
double **extents; /**< array of extents (one for each resolution) */
+
+ apr_table_t *metadata;
};
/**\class geocache_tileset
@@ -747,6 +754,8 @@
* handle to the configuration this tileset belongs to
*/
geocache_cfg *config;
+
+ apr_table_t *metadata;
};
/**
@@ -875,6 +884,7 @@
/**< pointer to a function that returns a geocache_buffer containing the given image encoded
* in the specified format
*/
+ apr_table_t *metadata;
};
/**\defgroup imageio_png PNG Image IO
Modified: trunk/mapserver/mapcache/src/cache_disk.c
===================================================================
--- trunk/mapserver/mapcache/src/cache_disk.c 2011-08-26 11:07:21 UTC (rev 12209)
+++ trunk/mapserver/mapcache/src/cache_disk.c 2011-08-26 11:07:29 UTC (rev 12210)
@@ -305,6 +305,7 @@
return NULL;
}
cache->symlink_blank = 0;
+ cache->cache.metadata = apr_table_make(ctx->pool,3);
cache->cache.type = GEOCACHE_CACHE_DISK;
cache->cache.tile_get = _geocache_cache_disk_get;
cache->cache.tile_exists = _geocache_cache_disk_has_tile;
Modified: trunk/mapserver/mapcache/src/configuration.c
===================================================================
--- trunk/mapserver/mapcache/src/configuration.c 2011-08-26 11:07:21 UTC (rev 12209)
+++ trunk/mapserver/mapcache/src/configuration.c 2011-08-26 11:07:29 UTC (rev 12210)
@@ -74,6 +74,7 @@
cfg->tilesets = apr_hash_make(pool);
cfg->grids = apr_hash_make(pool);
cfg->image_formats = apr_hash_make(pool);
+ cfg->metadata = apr_table_make(pool,3);
geocache_configuration_add_image_format(cfg,
geocache_imageio_create_png_format(pool,"PNG",GEOCACHE_COMPRESSION_FAST),
@@ -90,6 +91,8 @@
grid = geocache_grid_create(pool);
grid->name = "WGS84";
+ apr_table_add(grid->metadata,"title","GoogleCRS84Quad");
+ apr_table_add(grid->metadata,"wellKnownScaleSet","urn:ogc:def:wkss:OGC:1.0:GoogleCRS84Quad");
grid->srs = "epsg:4326";
grid->unit = GEOCACHE_UNIT_DEGREES;
grid->tile_sx = grid->tile_sy = 256;
@@ -110,6 +113,8 @@
grid = geocache_grid_create(pool);
grid->name = "google";
grid->srs = "epsg:900913";
+ apr_table_add(grid->metadata,"title","GoogleMapsCompatible");
+ apr_table_add(grid->metadata,"wellKnownScaleSet","urn:ogc:def:wkss:OGC:1.0:GoogleMapsCompatible");
grid->tile_sx = grid->tile_sy = 256;
grid->resolutions = google_resolutions;
grid->levels = 19;
@@ -190,6 +195,20 @@
}
}
+void parseMetadata(geocache_context *ctx, xmlNode *node, apr_table_t *metadata) {
+ xmlNode *cur_node;
+ char *value;
+ if(xmlStrcmp(node->name, BAD_CAST "metadata")) {
+ ctx->set_error(ctx, GEOCACHE_PARSE_ERROR, "SEVERE: <%s> is not a metadata tag",node->name);
+ return;
+ }
+ for(cur_node = node->children; cur_node; cur_node = cur_node->next) {
+ if(cur_node->type != XML_ELEMENT_NODE) continue;
+ value = (char*)xmlNodeGetContent(cur_node);
+ apr_table_add(metadata,(char*)cur_node->name, value);
+ }
+}
+
void parseGrid(geocache_context *ctx, xmlNode *node, geocache_cfg *config) {
char *name = NULL, *type = NULL;
double extent[4] = {0,0,0,0};
@@ -233,6 +252,9 @@
extent[2] = values[2];
extent[3] = values[3];
xmlFree(value);
+ } else if(!xmlStrcmp(cur_node->name, BAD_CAST "metadata")) {
+ parseMetadata(ctx, cur_node, grid->metadata);
+ GC_CHECK_ERROR(ctx);
} else if(!xmlStrcmp(cur_node->name, BAD_CAST "srs")) {
value = (char*)xmlNodeGetContent(cur_node);
grid->srs = value;
@@ -344,7 +366,10 @@
if(!xmlStrcmp(cur_node->name, BAD_CAST "srs")) {
char* value = (char*)xmlNodeGetContent(cur_node);
source->srs = value;
- }
+ } else if(!xmlStrcmp(cur_node->name, BAD_CAST "metadata")) {
+ parseMetadata(ctx, cur_node, source->metadata);
+ GC_CHECK_ERROR(ctx);
+ }
}
source->configuration_parse(ctx,node,source);
@@ -522,6 +547,9 @@
}
tileset->grid = grid;
xmlFree(BAD_CAST value);
+ } else if(!xmlStrcmp(cur_node->name, BAD_CAST "metadata")) {
+ parseMetadata(ctx, cur_node, tileset->metadata);
+ GC_CHECK_ERROR(ctx);
} else if(!xmlStrcmp(cur_node->name, BAD_CAST "cache")) {
value = (char*)xmlNodeGetContent(cur_node);
geocache_cache *cache = geocache_configuration_get_cache(config, value);
@@ -629,8 +657,10 @@
void geocache_configuration_parse(geocache_context *ctx, const char *filename, geocache_cfg *config) {
xmlDocPtr doc;
+#ifdef notused
char *testlockfilename;
apr_file_t *testlockfile;
+#endif
doc = xmlReadFile(filename, NULL, 0);
if (doc == NULL) {
ctx->set_error(ctx,GEOCACHE_PARSE_ERROR, "libxml2 failed to parse file %s. Is it valid XML?", filename);
@@ -647,6 +677,9 @@
if(!xmlStrcmp(cur_node->name, BAD_CAST "source")) {
parseSource(ctx, cur_node, config);
GC_CHECK_ERROR(ctx);
+ } else if(!xmlStrcmp(cur_node->name, BAD_CAST "metadata")) {
+ parseMetadata(ctx, cur_node, config->metadata);
+ GC_CHECK_ERROR(ctx);
} else if(!xmlStrcmp(cur_node->name, BAD_CAST "cache")) {
parseCache(ctx, cur_node, config);
GC_CHECK_ERROR(ctx);
Modified: trunk/mapserver/mapcache/src/grid.c
===================================================================
--- trunk/mapserver/mapcache/src/grid.c 2011-08-26 11:07:21 UTC (rev 12209)
+++ trunk/mapserver/mapcache/src/grid.c 2011-08-26 11:07:29 UTC (rev 12210)
@@ -21,5 +21,6 @@
*/
geocache_grid* geocache_grid_create(apr_pool_t *pool) {
geocache_grid* grid = (geocache_grid*)apr_pcalloc(pool, sizeof(geocache_grid));
+ grid->metadata = apr_table_make(pool,3);
return grid;
}
Modified: trunk/mapserver/mapcache/src/imageio_jpeg.c
===================================================================
--- trunk/mapserver/mapcache/src/imageio_jpeg.c 2011-08-26 11:07:21 UTC (rev 12209)
+++ trunk/mapserver/mapcache/src/imageio_jpeg.c 2011-08-26 11:07:29 UTC (rev 12210)
@@ -257,6 +257,7 @@
format->format.name = name;
format->format.extension = apr_pstrdup(pool,"jpg");
format->format.mime_type = apr_pstrdup(pool,"image/jpeg");
+ format->format.metadata = apr_table_make(pool,3);
format->format.write = _geocache_imageio_jpeg_encode;
format->quality = quality;
Modified: trunk/mapserver/mapcache/src/imageio_png.c
===================================================================
--- trunk/mapserver/mapcache/src/imageio_png.c 2011-08-26 11:07:21 UTC (rev 12209)
+++ trunk/mapserver/mapcache/src/imageio_png.c 2011-08-26 11:07:29 UTC (rev 12210)
@@ -1071,6 +1071,7 @@
format->format.extension = apr_pstrdup(pool,"png");
format->format.mime_type = apr_pstrdup(pool,"image/png");
format->compression_level = compression;
+ format->format.metadata = apr_table_make(pool,3);
format->format.write = _geocache_imageio_png_encode;
return (geocache_image_format*)format;
}
@@ -1082,6 +1083,7 @@
format->format.format.mime_type = apr_pstrdup(pool,"image/png");
format->format.compression_level = compression;
format->format.format.write = _geocache_imageio_png_q_encode;
+ format->format.format.metadata = apr_table_make(pool,3);
format->ncolors = ncolors;
return (geocache_image_format*)format;
}
Modified: trunk/mapserver/mapcache/src/services.c
===================================================================
--- trunk/mapserver/mapcache/src/services.c 2011-08-26 11:07:21 UTC (rev 12209)
+++ trunk/mapserver/mapcache/src/services.c 2011-08-26 11:07:29 UTC (rev 12210)
@@ -33,8 +33,8 @@
"<WMT_MS_Capabilities version=\"1.1.1\">\n"
"<Service>\n"
"<Name>OGC:WMS</Name>\n"
- "<Title></Title>\n"
- "<OnlineResource xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"%s\"/>\n"
+ "<Title>%s</Title>\n"
+ "<OnlineResource xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"%s/wms?\"/>\n"
"</Service>\n"
"<Capability>\n"
"<Request>\n"
@@ -42,7 +42,7 @@
"<Format>application/vnd.ogc.wms_xml</Format>\n"
"<DCPType>\n"
"<HTTP>\n"
- "<Get><OnlineResource xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"%s\"/></Get>\n"
+ "<Get><OnlineResource xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"%s/wms?\"/></Get>\n"
"</HTTP>\n"
"</DCPType>\n"
"</GetCapabilities>\n"
@@ -51,7 +51,7 @@
"<Format>image/jpeg</Format>\n"
"<DCPType>\n"
"<HTTP>\n"
- "<Get><OnlineResource xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"%s\"/></Get>\n"
+ "<Get><OnlineResource xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"%s/wms?\"/></Get>\n"
"</HTTP>\n"
"</DCPType>\n"
"</GetMap>\n"
@@ -68,7 +68,7 @@
"<Resolutions>%s</Resolutions>\n"
"<Width>%d</Width>\n"
"<Height>%d</Height>\n"
- "<Format>image/png</Format>\n"
+ "<Format>%s</Format>\n"
"<Layers>%s</Layers>\n"
"<Styles></Styles>\n"
"</TileSet>\n";
@@ -76,11 +76,12 @@
static char *wms_layer = "<Layer queryable=\"0\" opaque=\"0\" cascaded=\"1\">\n"
"<Name>%s</Name>\n"
"<Title>%s</Title>\n"
+ "<Abstract>%s</Abstract>\n"
"<SRS>%s</SRS>\n"
"<BoundingBox srs=\"%s\" minx=\"%f\" miny=\"%f\" maxx=\"%f\" maxy=\"%f\" />\n"
"</Layer>\n";
-void _create_capabilities_wms(geocache_context *ctx, geocache_request_get_capabilities *req, char *url, char *path_info, geocache_cfg *cfg) {
+void _create_capabilities_wms(geocache_context *ctx, geocache_request_get_capabilities *req, char *guessed_url, char *path_info, geocache_cfg *cfg) {
geocache_request_get_capabilities_wms *request = (geocache_request_get_capabilities_wms*)req;
#ifdef DEBUG
if(request->request.request.type != GEOCACHE_REQUEST_GET_CAPABILITIES) {
@@ -88,7 +89,17 @@
return;
}
#endif
- char *caps = apr_psprintf(ctx->pool,wms_capabilities_preamble,url,url,url);
+ const char *title;
+ const char *url = apr_table_get(cfg->metadata,"url");
+ if(!url) {
+ url = guessed_url;
+ }
+
+ title = apr_table_get(cfg->metadata,"title");
+ if(!title) {
+ title = "no title set, add some in metadata";
+ }
+ char *caps = apr_psprintf(ctx->pool,wms_capabilities_preamble,title,url,url,url);
apr_hash_index_t *tileindex_index = apr_hash_first(ctx->pool,cfg->tilesets);
while(tileindex_index) {
@@ -110,6 +121,7 @@
resolutions,
tileset->grid->tile_sx,
tileset->grid->tile_sy,
+ tileset->format->mime_type,
tileset->name);
caps = apr_psprintf(ctx->pool,"%s%s",caps,tilesetcaps);
tileindex_index = apr_hash_next(tileindex_index);
@@ -124,9 +136,18 @@
geocache_tileset *tileset;
const void *key; apr_ssize_t keylen;
apr_hash_this(tileindex_index,&key,&keylen,(void**)&tileset);
+ const char *title = apr_table_get(tileset->metadata,"title");
+ if(!title) {
+ title = "no title set, add some in metadata";
+ }
+ const char *abstract = apr_table_get(tileset->metadata,"abstract");
+ if(!abstract) {
+ abstract = "no abstract set, add some in metadata";
+ }
char *layercaps = apr_psprintf(ctx->pool,wms_layer,
tileset->name,
- tileset->name,
+ title,
+ abstract,
tileset->grid->srs,
tileset->grid->srs,
tileset->grid->extents[0][0],
@@ -159,7 +180,7 @@
"</ows:ServiceIdentification>\n"
"<ows:ServiceProvider>\n"
" <ows:ProviderName>%s</ows:ProviderName>\n"
- " <ows:ProviderSite xlink:href=\"%s\" />\n"
+ " <ows:ProviderSite xlink:href=\"%s/wmts?\" />\n"
" <ows:ServiceContact>\n"
" <ows:IndividualName>%s</ows:IndividualName>\n"
" </ows:ServiceContact>\n"
@@ -168,7 +189,7 @@
" <ows:Operation name=\"GetCapabilities\">\n"
" <ows:DCP>\n"
" <ows:HTTP>\n"
- " <ows:Get xlink:href=\"%s\">\n"
+ " <ows:Get xlink:href=\"%s/wmts?\">\n"
" <ows:Constraint name=\"GetEncoding\">\n"
" <ows:AllowedValues>\n"
" <ows:Value>KVP</ows:Value>\n"
@@ -181,7 +202,7 @@
" <ows:Operation name=\"GetTile\">\n"
" <ows:DCP>\n"
" <ows:HTTP>\n"
- " <ows:Get xlink:href=\"%s\">\n"
+ " <ows:Get xlink:href=\"%s/wmts?\">\n"
" <ows:Constraint name=\"GetEncoding\">\n"
" <ows:AllowedValues>\n"
" <ows:Value>KVP</ows:Value>\n"
@@ -209,17 +230,28 @@
void _create_capabilities_wmts(geocache_context *ctx, geocache_request_get_capabilities *req, char *url, char *path_info, geocache_cfg *cfg) {
geocache_request_get_capabilities_wmts *request = (geocache_request_get_capabilities_wmts*)req;
char *caps;
- char *onlineresource = apr_pstrcat(ctx->pool,url,"/",req->request.service->url_prefix,"?",NULL);
#ifdef DEBUG
if(request->request.request.type != GEOCACHE_REQUEST_GET_CAPABILITIES) {
ctx->set_error(ctx,GEOCACHE_ERROR,"wrong wms capabilities request");
return;
}
#endif
+
+ const char *title;
+ const char *onlineresource = apr_table_get(cfg->metadata,"url");
+ if(!onlineresource) {
+ onlineresource = url;
+ }
+
+ title = apr_table_get(cfg->metadata,"title");
+ if(!title) {
+ title = "no title set, add some in metadata";
+ }
+
request->request.mime_type = apr_pstrdup(ctx->pool,"application/xml");
caps = apr_psprintf(ctx->pool,wmts_0,
- "title_todo", "providername_todo", "individualname_todo",
+ title, "providername_todo", onlineresource, "individualname_todo",
onlineresource,onlineresource,onlineresource);
@@ -231,6 +263,7 @@
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*/
@@ -240,11 +273,21 @@
} 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;
@@ -271,6 +314,16 @@
geocache_tileset *tileset;
const void *key; apr_ssize_t keylen;
apr_hash_this(layer_index,&key,&keylen,(void**)&tileset);
+
+ const char *title = apr_table_get(tileset->metadata,"title");
+ if(!title) {
+ title = "no title set, add some in metadata";
+ }
+ const char *abstract = apr_table_get(tileset->metadata,"abstract");
+ if(!abstract) {
+ abstract = "no abstract set, add some in metadata";
+ }
+
caps = apr_psprintf(ctx->pool,"%s"
" <Layer>\n"
" <ows:Title>%s</ows:Title>\n"
@@ -287,7 +340,7 @@
" <TileMatrixSetLink>\n"
" <TileMatrixSet>%s</TileMatrixSet>\n"
" </TileMatrixSetLink>\n"
- " </Layer>",caps,tileset->name,"abstract_todo",
+ " </Layer>",caps,title,abstract,
tileset->name,tileset->format->mime_type,tileset->grid->name);
layer_index = apr_hash_next(layer_index);
}
@@ -297,19 +350,19 @@
static const char *tms_0 = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
"<Services>\n"
- "<TileMapService version=\"1.0.0\" href=\"%s/1.0.0/\" />\n"
+ "<TileMapService version=\"1.0.0\" href=\"%s/tms/1.0.0/\" />\n"
"</Services>\n";
static const char *tms_1 = "<TileMap \n"
- "href=\"%s/%s/%s/\"\n"
+ "href=\"%s/tms/%s/%s/\"\n"
"srs=\"%s\"\n"
"title=\"%s\"\n"
"profile=\"global-geodetic\" />";
static const char *tms_2="<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
- "<TileMap version=\"%s\" tilemapservice=\"%s/%s/\">\n"
+ "<TileMap version=\"%s\" tilemapservice=\"%s/tms/%s/\">\n"
"<Title>%s</Title>\n"
- "<Abstract/>\n"
+ "<Abstract>%s</Abstract>\n"
"<SRS>%s</SRS>\n"
"<BoundingBox minx=\"%f\" miny=\"%f\" maxx=\"%f\" maxy=\"%f\"/>\n"
"<Origin x=\"%f\" y=\"%f\"/>\n"
@@ -326,9 +379,13 @@
}
#endif
char *caps;
+ const char *onlineresource = apr_table_get(cfg->metadata,"url");
+ if(!onlineresource) {
+ onlineresource = url;
+ }
request->request.mime_type = apr_pstrdup(ctx->pool,"text/xml");
if(!request->version) {
- caps = apr_psprintf(ctx->pool,tms_0,url);
+ caps = apr_psprintf(ctx->pool,tms_0,onlineresource);
} else {
if(!request->tileset) {
caps = apr_psprintf(ctx->pool,"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
@@ -342,7 +399,12 @@
char *tilesetcaps;
const void *key; apr_ssize_t keylen;
apr_hash_this(tileindex_index,&key,&keylen,(void**)&tileset);
- tilesetcaps = apr_psprintf(ctx->pool,tms_1,url,request->version,tileset->name,tileset->grid->srs,tileset->name);
+ const char *title = apr_table_get(tileset->metadata,"title");
+ if(!title) {
+ title = "no title set, add some in metadata";
+ }
+ tilesetcaps = apr_psprintf(ctx->pool,tms_1,onlineresource,
+ request->version,tileset->name,tileset->grid->srs,title);
caps = apr_psprintf(ctx->pool,"%s%s",caps,tilesetcaps);
tileindex_index = apr_hash_next(tileindex_index);
}
@@ -352,9 +414,17 @@
geocache_tileset *tileset = request->tileset;
geocache_grid *grid = tileset->grid;
int i;
+ const char *title = apr_table_get(tileset->metadata,"title");
+ if(!title) {
+ title = "no title set, add some in metadata";
+ }
+ const char *abstract = apr_table_get(tileset->metadata,"abstract");
+ if(!abstract) {
+ abstract = "no abstract set, add some in metadata";
+ }
caps = apr_psprintf(ctx->pool,tms_2,
- request->version, url, request->version,
- tileset->name, grid->srs,
+ request->version, onlineresource, request->version,
+ title,abstract, grid->srs,
grid->extents[0][0], grid->extents[0][1],
grid->extents[0][2], grid->extents[0][3],
grid->extents[0][0], grid->extents[0][1],
@@ -364,7 +434,7 @@
);
for(i=0;i<grid->levels;i++) {
caps = apr_psprintf(ctx->pool,"%s\n<TileSet href=\"%s/%s/%s/%d\" units-per-pixel=\"%.20f\" order=\"%d\"/>",
- caps,url,request->version,tileset->name,i,
+ caps,onlineresource,request->version,tileset->name,i,
grid->resolutions[i],i
);
}
@@ -621,6 +691,10 @@
char *url, char *path_info, geocache_cfg *cfg) {
geocache_request_get_capabilities *request = (geocache_request_get_capabilities*)req;
request->mime_type = apr_pstrdup(ctx->pool,"text/html");
+ const char *onlineresource = apr_table_get(cfg->metadata,"url");
+ if(!onlineresource) {
+ onlineresource = url;
+ }
char *caps = apr_pstrdup(ctx->pool,demo_head);
apr_hash_index_t *tileindex_index = apr_hash_first(ctx->pool,cfg->tilesets);
char *layers="";
@@ -638,7 +712,7 @@
char *ol_layer = apr_psprintf(ctx->pool,demo_layer,
tileset->name,
tileset->name,
- apr_pstrcat(ctx->pool,url,"/wms?",NULL),
+ apr_pstrcat(ctx->pool,onlineresource,"/wms?",NULL),
tileset->name,resolutions,
tileset->grid->extents[0][0],
tileset->grid->extents[0][1],
Modified: trunk/mapserver/mapcache/src/source.c
===================================================================
--- trunk/mapserver/mapcache/src/source.c 2011-08-26 11:07:21 UTC (rev 12209)
+++ trunk/mapserver/mapcache/src/source.c 2011-08-26 11:07:29 UTC (rev 12210)
@@ -15,6 +15,8 @@
*/
#include "geocache.h"
+
+
void geocache_source_init(geocache_context *ctx, geocache_source *source) {
source->data_extent[0] =
source->data_extent[1] =
@@ -22,4 +24,5 @@
source->data_extent[3] = -1;
source->srs = NULL;
source->supports_metatiling = 0;
+ source->metadata = apr_table_make(ctx->pool,3);
}
Modified: trunk/mapserver/mapcache/src/tileset.c
===================================================================
--- trunk/mapserver/mapcache/src/tileset.c 2011-08-26 11:07:21 UTC (rev 12209)
+++ trunk/mapserver/mapcache/src/tileset.c 2011-08-26 11:07:29 UTC (rev 12210)
@@ -184,6 +184,7 @@
tileset->metabuffer = 0;
tileset->expires = 0;
tileset->forwarded_params = apr_table_make(ctx->pool,1);
+ tileset->metadata = apr_table_make(ctx->pool,3);
tileset->format = NULL;
tileset->grid = NULL;
tileset->config = NULL;
More information about the mapserver-commits
mailing list