Skip to content

Commit

Permalink
WCS 1.1 GetCoverage response: honour EPSG axis order for GridOrigin a…
Browse files Browse the repository at this point in the history
…nd GridOffsets (#5504)

F.3.4 2D simple grid (urn:ogc:def:method:WCS:1.1:2dSimpleGrid) of
https://portal.opengeospatial.org/files/07-067r2 makes it clear that EPSG axis
order should be followed, in the note of EXAMPLE 1 at page 88
'''(in this case, degrees of latitude and longitude, in that order).'''
  • Loading branch information
rouault committed Oct 31, 2017
1 parent 91fafe4 commit 4f75206
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions mapwcs11.c
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,18 @@ msWCSDescribeCoverage_CoverageDescription11(
/* -------------------------------------------------------------------- */
{
char format_buf[500];
projectionObj proj;
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];

msInitProjection( &proj );
if( msLoadProjectionString( &proj, cm.srs_urn ) == 0 ) {
msAxisNormalizePoints( &proj, 1, &x0, &y0 );
msAxisNormalizePoints( &proj, 1, &resx, &resy );
}
msFreeProjection( &proj );

psGridCRS = xmlNewChild( psSD, NULL, BAD_CAST "GridCRS", NULL );

Expand All @@ -728,13 +740,10 @@ msWCSDescribeCoverage_CoverageDescription11(
xmlNewChild( psGridCRS, NULL, BAD_CAST "GridType",
BAD_CAST "urn:ogc:def:method:WCS:1.1:2dSimpleGrid" );

sprintf( format_buf, "%.15g %.15g",
cm.geotransform[0]+cm.geotransform[1]/2+cm.geotransform[2]/2,
cm.geotransform[3]+cm.geotransform[4]/2+cm.geotransform[5]/2);
sprintf( format_buf, "%.15g %.15g", x0, y0 );
xmlNewChild( psGridCRS, NULL, BAD_CAST "GridOrigin", BAD_CAST format_buf );

sprintf( format_buf, "%.15g %.15g",
cm.geotransform[1], cm.geotransform[5] );
sprintf( format_buf, "%.15g %.15g", resx, resy );
xmlNewChild( psGridCRS, NULL, BAD_CAST "GridOffsets", BAD_CAST format_buf );

xmlNewChild( psGridCRS, NULL, BAD_CAST "GridCS",
Expand Down

0 comments on commit 4f75206

Please sign in to comment.