Skip to content

Commit 24a4c02

Browse files
committed
Add <wms_querybymap> configuration tag for querying dimension at WMS map level instead of tile level
1 parent 30adc48 commit 24a4c02

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

include/mapcache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1578,7 +1578,7 @@ MS_DLL_EXPORT apr_array_header_t *mapcache_requested_dimensions_clone(apr_pool_t
15781578
struct mapcache_dimension {
15791579
mapcache_dimension_type type;
15801580
int isTime;
1581-
int wms_single_query_minzoom;
1581+
int wms_querybymap_minzoom;
15821582
char *name;
15831583
char *unit;
15841584
apr_table_t *metadata;

lib/configuration_xml.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void parseMetadata(mapcache_context *ctx, ezxml_t node, apr_table_t *metadata)
6363
void parseDimensions(mapcache_context *ctx, ezxml_t node, mapcache_tileset *tileset)
6464
{
6565
ezxml_t dimension_node;
66-
ezxml_t wms_single_query_node;
66+
ezxml_t wms_querybymap_node;
6767
apr_array_header_t *dimensions = apr_array_make(ctx->pool,1,sizeof(mapcache_dimension*));
6868
for(dimension_node = ezxml_child(node,"dimension"); dimension_node; dimension_node = dimension_node->next) {
6969
char *name = (char*)ezxml_attr(dimension_node,"name");
@@ -121,23 +121,23 @@ void parseDimensions(mapcache_context *ctx, ezxml_t node, mapcache_tileset *tile
121121
return;
122122
}
123123

124-
dimension->wms_single_query_minzoom = -1;
125-
wms_single_query_node = ezxml_child(dimension_node,"wms_single_query");
126-
if (wms_single_query_node && wms_single_query_node->txt) {
127-
if (!strcasecmp(wms_single_query_node->txt,"true")) {
128-
const char * minzoom = ezxml_attr(wms_single_query_node,"minzoom");
129-
dimension->wms_single_query_minzoom = 0;
124+
dimension->wms_querybymap_minzoom = -1;
125+
wms_querybymap_node = ezxml_child(dimension_node,"wms_querybymap");
126+
if (wms_querybymap_node && wms_querybymap_node->txt) {
127+
if (!strcasecmp(wms_querybymap_node->txt,"true")) {
128+
const char * minzoom = ezxml_attr(wms_querybymap_node,"minzoom");
129+
dimension->wms_querybymap_minzoom = 0;
130130
if (minzoom && *minzoom) {
131131
char *endptr;
132-
dimension->wms_single_query_minzoom = strtol(minzoom,&endptr,10);
133-
if (*endptr != 0 || dimension->wms_single_query_minzoom < 0) {
134-
ctx->set_error(ctx, 400, "failed to parse minzoom \"%s\" for <wms_single_query>"
132+
dimension->wms_querybymap_minzoom = strtol(minzoom,&endptr,10);
133+
if (*endptr != 0 || dimension->wms_querybymap_minzoom < 0) {
134+
ctx->set_error(ctx, 400, "failed to parse minzoom \"%s\" for <wms_querybymap>"
135135
"expecting an integer starting from 0",minzoom);
136136
return;
137137
}
138138
}
139-
} else if (strcasecmp(wms_single_query_node->txt,"false")) {
140-
ctx->set_error(ctx,400,"failed to parse <wms_single_query> (%s), expecting \"true\" or \"false\"",wms_single_query_node->txt);
139+
} else if (strcasecmp(wms_querybymap_node->txt,"false")) {
140+
ctx->set_error(ctx,400,"failed to parse <wms_querybymap> (%s), expecting \"true\" or \"false\"",wms_querybymap_node->txt);
141141
return;
142142
}
143143
}

lib/tileset.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,15 +226,15 @@ void mapcache_tileset_get_map_tiles(mapcache_context *ctx, mapcache_tileset *til
226226
level = (*effectively_used_grid_link)->max_cached_zoom;
227227
}
228228

229-
// Get dimensions values for whole map if required by <wms_single_query> configuration
229+
// Get dimensions values for whole map if required by <wms_querybymap> configuration
230230
if (dimensions)
231231
{
232232
int j;
233233
for (j=0 ; j<dimensions->nelts ; j++)
234234
{
235235
mapcache_requested_dimension *rdim = APR_ARRAY_IDX(dimensions,j,mapcache_requested_dimension*);
236236
mapcache_dimension *dim = rdim->dimension;
237-
if (dim->wms_single_query_minzoom != -1 && level >= dim->wms_single_query_minzoom) {
237+
if (dim->wms_querybymap_minzoom != -1 && level >= dim->wms_querybymap_minzoom) {
238238
rdim->cached_entries_for_value =
239239
mapcache_dimension_get_entries_for_value(ctx,rdim->dimension,rdim->requested_value,
240240
tileset,bbox,(*effectively_used_grid_link)->grid);

0 commit comments

Comments
 (0)