Skip to content

Commit

Permalink
WCS 2.0 DescribeCoverage result: fix RectifiedGrid.origin.Point to co…
Browse files Browse the repository at this point in the history
…rrespond to the coordinate of the pixel center (fixes #5511)
  • Loading branch information
rouault committed Nov 9, 2017
1 parent 2a990dc commit 31c25df
Show file tree
Hide file tree
Showing 17 changed files with 22 additions and 16 deletions.
24 changes: 15 additions & 9 deletions mapwcs20.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion msautotest/wxs/expected/wcs_20_desc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion msautotest/wxs/expected/wcs_20_desc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
4 changes: 2 additions & 2 deletions msautotest/wxs/expected/wcs_20_desc_bands.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
Binary file modified msautotest/wxs/expected/wcs_20_getcov_bands_name.dat
Binary file not shown.
Binary file modified msautotest/wxs/expected/wcs_20_getcov_bands_name_new.dat
Binary file not shown.
Binary file modified msautotest/wxs/expected/wcs_20_getcov_bands_name_new_reproject.dat
Binary file not shown.
Binary file modified msautotest/wxs/expected/wcs_20_getcov_full.dat
Binary file not shown.
2 changes: 1 addition & 1 deletion msautotest/wxs/expected/wcs_20_getcov_grd_mp.dat
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Binary file modified msautotest/wxs/expected/wcs_20_getcov_reproj.dat
Binary file not shown.
Binary file modified msautotest/wxs/expected/wcs_20_post_bands_name.dat
Binary file not shown.
Binary file modified msautotest/wxs/expected/wcs_20_post_bands_name_new.dat
Binary file not shown.
2 changes: 1 addition & 1 deletion msautotest/wxs/expected/wcs_20_post_desc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Binary file modified msautotest/wxs/expected/wcs_20_post_getcov_full_multipart.dat
Binary file not shown.
Binary file modified msautotest/wxs/expected/wcs_mask_20_getcov_full.dat
Binary file not shown.
2 changes: 1 addition & 1 deletion msautotest/wxs/expected/wcs_mask_20_getcov_grd_mp.dat
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Binary file modified msautotest/wxs/expected/wcs_mask_20_getcov_reproj.dat
Binary file not shown.

0 comments on commit 31c25df

Please sign in to comment.