Skip to content

Commit bf27d13

Browse files
committed
Return list of supported versions in WCS GetCapabilities. Fixes #5046.
1 parent 1b297e6 commit bf27d13

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

mapowscommon.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,15 @@
5656
*
5757
* @param map mapObj used to fetch WEB/METADATA
5858
* @param servicetype the OWS type
59-
* @param version the version of the OWS
59+
* @param supported_versions the supported version(s) of the OWS
6060
*
6161
* @return psRootNode xmlNodePtr of XML construct
6262
*
6363
*/
6464

6565
xmlNodePtr msOWSCommonServiceIdentification(xmlNsPtr psNsOws, mapObj *map,
6666
const char *servicetype,
67-
const char *version,
67+
const char *supported_versions,
6868
const char *namespaces,
6969
const char *validated_language)
7070
{
@@ -112,7 +112,7 @@ xmlNodePtr msOWSCommonServiceIdentification(xmlNsPtr psNsOws, mapObj *map,
112112

113113
xmlNewProp(psNode, BAD_CAST "codeSpace", BAD_CAST MS_OWSCOMMON_OGC_CODESPACE);
114114

115-
psNode = xmlNewChild(psRootNode, psNsOws, BAD_CAST "ServiceTypeVersion", BAD_CAST version);
115+
msLibXml2GenerateList(psRootNode, psNsOws, "ServiceTypeVersion", supported_versions, ',');
116116

117117
value = msOWSLookupMetadataWithLanguage(&(map->web.metadata), namespaces, "fees", validated_language);
118118

mapwcs11.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ int msWCSGetCapabilities11(mapObj *map, wcsParamsObj *params,
459459
|| strstr(params->section,"All") != NULL
460460
|| strstr(params->section,"ServiceIdentification") != NULL ) {
461461
xmlAddChild(psRootNode, msOWSCommonServiceIdentification(
462-
psOwsNs, map, "OGC WCS", params->version, "CO", NULL));
462+
psOwsNs, map, "OGC WCS", "2.0.1,1.1.1,1.0.0", "CO", NULL));
463463
}
464464

465465
/*service provider*/

mapwcs20.c

+19-19
Original file line numberDiff line numberDiff line change
@@ -634,8 +634,8 @@ static int msWCSParseScaleString20(char *string,
634634
/* Subset string: axis ( value ) */
635635
/************************************************************************/
636636

637-
static int msWCSParseScaleExtentString20(char *string, char *outAxis,
638-
size_t axisStringLen,
637+
static int msWCSParseScaleExtentString20(char *string, char *outAxis,
638+
size_t axisStringLen,
639639
int *outMin, int *outMax)
640640
{
641641
char *number = NULL;
@@ -720,7 +720,7 @@ xmlNodePtr msLibXml2GetFirstChild(xmlNodePtr parent, const char *name) {
720720

721721

722722
/*
723-
Utility function to get the first child of a node with a given node name and
723+
Utility function to get the first child of a node with a given node name and
724724
namespace.
725725
*/
726726

@@ -736,7 +736,7 @@ xmlNodePtr msLibXml2GetFirstChildNs(xmlNodePtr parent, const char *name, xmlNsPt
736736
return node;
737737
}
738738
}
739-
return NULL;
739+
return NULL;
740740
}
741741

742742
/************************************************************************/
@@ -1243,7 +1243,7 @@ static int msWCSParseRequest20_XMLGetCoverage(
12431243
XML_FOREACH_CHILD(extensionNode, rangeItemNode) {
12441244

12451245
XML_LOOP_IGNORE_COMMENT_OR_TEXT(rangeItemNode);
1246-
1246+
12471247
XML_ASSERT_NODE_NAME(rangeItemNode, "RangeItem");
12481248

12491249
if (!rangeItemNode->children) {
@@ -1278,7 +1278,7 @@ static int msWCSParseRequest20_XMLGetCoverage(
12781278
value = msSmallCalloc(length, sizeof(char));
12791279

12801280
snprintf(value, length, "%s:%s", start, stop);
1281-
1281+
12821282
xmlFree(start);
12831283
xmlFree(stop);
12841284

@@ -1296,7 +1296,7 @@ static int msWCSParseRequest20_XMLGetCoverage(
12961296

12971297
else if (EQUAL((char *) extensionNode->name, "outputCrs")) {
12981298
msFree(params->outputcrs);
1299-
params->outputcrs = (char *)xmlNodeGetContent(extensionNode);
1299+
params->outputcrs = (char *)xmlNodeGetContent(extensionNode);
13001300
}
13011301

13021302
else if (EQUAL((char *) extensionNode->name, "Interpolation")) {
@@ -1316,7 +1316,7 @@ static int msWCSParseRequest20_XMLGetCoverage(
13161316
}
13171317

13181318
/* GeoTIFF parameters */
1319-
else if (EQUAL((char *) extensionNode->name, "parameters")
1319+
else if (EQUAL((char *) extensionNode->name, "parameters")
13201320
&& extensionNode->ns
13211321
&& EQUAL((char *)extensionNode->ns->href, "http://www.opengis.net/gmlcov/geotiff/1.0")) {
13221322

@@ -1328,7 +1328,7 @@ static int msWCSParseRequest20_XMLGetCoverage(
13281328

13291329
content = (char *)xmlNodeGetContent(parameter);
13301330

1331-
params->format_options =
1331+
params->format_options =
13321332
CSLAddNameValue(params->format_options, (char *)parameter->name, content);
13331333
xmlFree(content);
13341334
}
@@ -1574,7 +1574,7 @@ int msWCSParseRequest20(mapObj *map,
15741574
char axisName[500];
15751575
int min, max;
15761576

1577-
if (msWCSParseScaleExtentString20(tokens[j], axisName, sizeof(axisName),
1577+
if (msWCSParseScaleExtentString20(tokens[j], axisName, sizeof(axisName),
15781578
&min, &max) != MS_SUCCESS) {
15791579
msFreeCharArray(tokens, num);
15801580
return MS_FAILURE;
@@ -1685,7 +1685,7 @@ int msWCSParseRequest20(mapObj *map,
16851685
}
16861686
msFreeCharArray(tokens, num);
16871687
} else if (EQUALN(key, "GEOTIFF:", 8)) {
1688-
params->format_options =
1688+
params->format_options =
16891689
CSLAddNameValue(params->format_options, key, value);
16901690
}
16911691
/* Ignore all other parameters here */
@@ -1711,7 +1711,7 @@ static int msWCSValidateAndFindAxes20(
17111711
static const int numAxis = 2;
17121712
char *validXAxisNames[] = {"x", "xaxis", "x-axis", "x_axis", "long", "long_axis", "long-axis", "lon", "lon_axis", "lon-axis", NULL};
17131713
char *validYAxisNames[] = {"y", "yaxis", "y-axis", "y_axis", "lat", "lat_axis", "lat-axis", NULL};
1714-
char **validAxisNames[2];
1714+
char **validAxisNames[2];
17151715
int iParamAxis, iAcceptedAxis, iName, i;
17161716

17171717
validAxisNames[0] = validXAxisNames;
@@ -3081,7 +3081,7 @@ static int msWCSGetCapabilities20_CreateProfiles(
30813081

30823082
/* navigate to node where profiles shall be inserted */
30833083
for(psTmpNode = psServiceIdentification->children; psTmpNode->next != NULL; psTmpNode = psTmpNode->next) {
3084-
if(EQUAL((char *)psTmpNode->name, "ServiceTypeVersion"))
3084+
if(EQUAL((char *)psTmpNode->name, "ServiceTypeVersion") && !EQUAL((char *)psTmpNode->next->name, "ServiceTypeVersion"))
30853085
break;
30863086
}
30873087

@@ -3237,7 +3237,7 @@ int msWCSGetCapabilities20(mapObj *map, cgiRequestObj *req,
32373237
/* -------------------------------------------------------------------- */
32383238
if ( MS_WCS_20_CAPABILITIES_INCLUDE_SECTION(params, "ServiceIdentification") ) {
32393239
psNode = xmlAddChild(psRootNode, msOWSCommonServiceIdentification(
3240-
psOwsNs, map, "OGC WCS", params->version, "CO", NULL));
3240+
psOwsNs, map, "OGC WCS", "2.0.1,1.1.1,1.0.0", "CO", NULL));
32413241
msWCSGetCapabilities20_CreateProfiles(map, psNode, psOwsNs);
32423242
}
32433243

@@ -3321,11 +3321,11 @@ int msWCSGetCapabilities20(mapObj *map, cgiRequestObj *req,
33213321
/* TODO: use URIs/URLs once they are specified */
33223322
char *interpolation_methods[] = {"NEAREST", "AVERAGE", "BILINEAR"};
33233323
int i;
3324-
xmlNodePtr imNode = xmlNewChild(psExtensionNode, psIntNs,
3324+
xmlNodePtr imNode = xmlNewChild(psExtensionNode, psIntNs,
33253325
BAD_CAST "InterpolationMetadata", NULL);
33263326

33273327
for (i=0; i < 3; ++i) {
3328-
xmlNewChild(imNode, psIntNs, BAD_CAST "InterpolationSupported",
3328+
xmlNewChild(imNode, psIntNs, BAD_CAST "InterpolationSupported",
33293329
BAD_CAST interpolation_methods[i]);
33303330
}
33313331
}
@@ -3339,7 +3339,7 @@ int msWCSGetCapabilities20(mapObj *map, cgiRequestObj *req,
33393339
if((crs_list = msOWSGetProjURI(&(map->projection),
33403340
&(map->web.metadata),
33413341
"CO", MS_FALSE)) != NULL ) {
3342-
msLibXml2GenerateList(crsMetadataNode, psCrsNs, "crsSupported",
3342+
msLibXml2GenerateList(crsMetadataNode, psCrsNs, "crsSupported",
33433343
crs_list, ' ');
33443344
} else {
33453345
/* could not determine list of CRSs */
@@ -3611,7 +3611,7 @@ static int msWCSGetCoverage20_FinalizeParamsObj(wcs20ParamsObjPtr params, wcs20A
36113611
char *crs = NULL;
36123612
int have_scale, have_size, have_resolution;
36133613
int have_global_scale = (params->scale != MS_WCS20_UNBOUNDED) ? 1 : 0;
3614-
3614+
36153615
if (axes[0] != NULL) {
36163616
if(axes[0]->subset != NULL) {
36173617
msDebug("Subset for X-axis found: %s\n", axes[0]->subset->axis);
@@ -4544,7 +4544,7 @@ this request. Check wcs/ows_enable_request settings.", "msWCSGetCoverage20()", p
45444544
/* set the imagetype from the original outputformat back (it was removed by msSelectOutputFormat() */
45454545
msFree(map->imagetype);
45464546
map->imagetype = origImageType;
4547-
4547+
45484548
}
45494549
}
45504550

0 commit comments

Comments
 (0)