Permalink
Browse files

WCS 2.0 DescribeCoverage result: fix RectifiedGrid.origin.Point to co…

…rrespond to the coordinate of the pixel center (fixes #5511)
  • Loading branch information...
rouault committed Nov 9, 2017
1 parent 2a990dc commit 31c25df6be067a59ffb89100f215d2d65840e364
View
@@ -2009,12 +2009,18 @@ static void msWCSCommon20_CreateDomainSet(layerObj* layer, wcs20coverageMetadata
{
xmlNodePtr psDomainSet, psGrid, psLimits, psGridEnvelope, psOrigin,
psOffsetX, psOffsetY;
char low[100], high[100], id[100], point[100], resx[100], resy[100], axisLabels[100];
char low[100], high[100], id[100], point[100];
char offsetVector1[100], offsetVector2[100], axisLabels[100];
psDomainSet = xmlNewChild( psRoot, psGmlNs, BAD_CAST "domainSet", NULL);
{
psGrid = xmlNewChild(psDomainSet, psGmlNs, BAD_CAST "RectifiedGrid", NULL);
{
double x0 = cm->geotransform[0]+cm->geotransform[1]/2+cm->geotransform[2]/2;
double y0 = cm->geotransform[3]+cm->geotransform[4]/2+cm->geotransform[5]/2;
double resx = cm->geotransform[1];
double resy = cm->geotransform[5];
xmlNewProp(psGrid, BAD_CAST "dimension", BAD_CAST "2");
snprintf(id, sizeof(id), "grid_%s", layer->name);
xmlNewNsProp(psGrid, psGmlNs, BAD_CAST "id", BAD_CAST id);
@@ -2050,9 +2056,9 @@ static void msWCSCommon20_CreateDomainSet(layerObj* layer, wcs20coverageMetadata
psOrigin = xmlNewChild(psGrid, psGmlNs, BAD_CAST "origin", NULL);
{
if (swapAxes == MS_FALSE) {
snprintf(point, sizeof(point), "%f %f", cm->extent.minx, cm->extent.maxy);
snprintf(point, sizeof(point), "%f %f", x0, y0);
} else {
snprintf(point, sizeof(point), "%f %f", cm->extent.maxy, cm->extent.minx);
snprintf(point, sizeof(point), "%f %f", y0, x0);
}
psOrigin = xmlNewChild(psOrigin, psGmlNs, BAD_CAST "Point", NULL);
snprintf(id, sizeof(id), "grid_origin_%s", layer->name);
@@ -2063,14 +2069,14 @@ static void msWCSCommon20_CreateDomainSet(layerObj* layer, wcs20coverageMetadata
}
if (swapAxes == MS_FALSE) {
snprintf(resx, sizeof(resx), "%f 0", cm->xresolution);
snprintf(resy, sizeof(resy), "0 %f", -fabs(cm->yresolution));
snprintf(offsetVector1, sizeof(offsetVector1), "%f 0", resx);
snprintf(offsetVector2, sizeof(offsetVector2), "0 %f", resy);
} else {
snprintf(resx, sizeof(resx), "0 %f", cm->xresolution);
snprintf(resy, sizeof(resy), "%f 0", -fabs(cm->yresolution));
snprintf(offsetVector1, sizeof(offsetVector1), "0 %f", resx);
snprintf(offsetVector2, sizeof(offsetVector2), "%f 0", resy);
}
psOffsetX = xmlNewChild(psGrid, psGmlNs, BAD_CAST "offsetVector", BAD_CAST resx);
psOffsetY = xmlNewChild(psGrid, psGmlNs, BAD_CAST "offsetVector", BAD_CAST resy);
psOffsetX = xmlNewChild(psGrid, psGmlNs, BAD_CAST "offsetVector", BAD_CAST offsetVector1);
psOffsetY = xmlNewChild(psGrid, psGmlNs, BAD_CAST "offsetVector", BAD_CAST offsetVector2);
xmlNewProp(psOffsetX, BAD_CAST "srsName", BAD_CAST cm->srs_uri);
xmlNewProp(psOffsetY, BAD_CAST "srsName", BAD_CAST cm->srs_uri);
@@ -21,7 +21,7 @@ Content-Type: text/xml; charset=UTF-8
<gml:axisLabels>x y</gml:axisLabels>
<gml:origin>
<gml:Point gml:id="grid_origin_grey" srsName="http://www.opengis.net/def/crs/EPSG/0/32611">
<gml:pos>0.000000 300.000000</gml:pos>
<gml:pos>5.000000 295.000000</gml:pos>
</gml:Point>
</gml:origin>
<gml:offsetVector srsName="http://www.opengis.net/def/crs/EPSG/0/32611">10.000000 0</gml:offsetVector>
@@ -19,7 +19,7 @@
<gml:axisLabels>x y</gml:axisLabels>
<gml:origin>
<gml:Point gml:id="grid_origin_grey" srsName="http://www.opengis.net/def/crs/EPSG/0/32611">
<gml:pos>0.000000 300.000000</gml:pos>
<gml:pos>5.000000 295.000000</gml:pos>
</gml:Point>
</gml:origin>
<gml:offsetVector srsName="http://www.opengis.net/def/crs/EPSG/0/32611">10.000000 0</gml:offsetVector>
@@ -19,7 +19,7 @@
<gml:axisLabels>lat long</gml:axisLabels>
<gml:origin>
<gml:Point gml:id="grid_origin_multi" srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
<gml:pos>49.891143 14.470271</gml:pos>
<gml:pos>49.874157 14.487132</gml:pos>
</gml:Point>
</gml:origin>
<gml:offsetVector srsName="http://www.opengis.net/def/crs/EPSG/0/4326">0 0.033722</gml:offsetVector>
@@ -207,7 +207,7 @@
<gml:axisLabels>lat long</gml:axisLabels>
<gml:origin>
<gml:Point gml:id="grid_origin_multi_new" srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
<gml:pos>49.891143 14.470271</gml:pos>
<gml:pos>49.874157 14.487132</gml:pos>
</gml:Point>
</gml:origin>
<gml:offsetVector srsName="http://www.opengis.net/def/crs/EPSG/0/4326">0 0.033722</gml:offsetVector>
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -23,7 +23,7 @@ Content-Type: application/gml+xml; charset=UTF-8
<gml:axisLabels>x y</gml:axisLabels>
<gml:origin>
<gml:Point gml:id="grid_origin_grey" srsName="http://www.opengis.net/def/crs/EPSG/0/32611">
<gml:pos>0.000000 300.000000</gml:pos>
<gml:pos>5.000000 295.000000</gml:pos>
</gml:Point>
</gml:origin>
<gml:offsetVector srsName="http://www.opengis.net/def/crs/EPSG/0/32611">10.000000 0</gml:offsetVector>
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -19,7 +19,7 @@
<gml:axisLabels>x y</gml:axisLabels>
<gml:origin>
<gml:Point gml:id="grid_origin_grey" srsName="http://www.opengis.net/def/crs/EPSG/0/32611">
<gml:pos>0.000000 300.000000</gml:pos>
<gml:pos>5.000000 295.000000</gml:pos>
</gml:Point>
</gml:origin>
<gml:offsetVector srsName="http://www.opengis.net/def/crs/EPSG/0/32611">10.000000 0</gml:offsetVector>
Binary file not shown.
Binary file not shown.
@@ -23,7 +23,7 @@ Content-Type: application/gml+xml; charset=UTF-8
<gml:axisLabels>x y</gml:axisLabels>
<gml:origin>
<gml:Point gml:id="grid_origin_grey" srsName="http://www.opengis.net/def/crs/EPSG/0/32611">
<gml:pos>0.000000 300.000000</gml:pos>
<gml:pos>5.000000 295.000000</gml:pos>
</gml:Point>
</gml:origin>
<gml:offsetVector srsName="http://www.opengis.net/def/crs/EPSG/0/32611">10.000000 0</gml:offsetVector>
Binary file not shown.

0 comments on commit 31c25df

Please sign in to comment.