Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Server, WCS] Fix several non compliance errors in CoverageDescription output #36754

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions src/server/services/wcs/qgswcsutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,28 +150,29 @@ namespace QgsWcs
QDomElement xAxisElem = doc.createElement( QStringLiteral( "gml:axisName" ) );
QDomText xAxisText = doc.createTextNode( QStringLiteral( "x" ) );
xAxisElem.appendChild( xAxisText );
spatialDomainElem.appendChild( xAxisElem );
rectGridElem.appendChild( xAxisElem );

QDomElement yAxisElem = doc.createElement( QStringLiteral( "gml:axisName" ) );
QDomText yAxisText = doc.createTextNode( QStringLiteral( "y" ) );
yAxisElem.appendChild( yAxisText );
spatialDomainElem.appendChild( yAxisElem );
rectGridElem.appendChild( yAxisElem );

QDomElement originElem = doc.createElement( QStringLiteral( "gml:origin" ) );
QDomElement originPosElem = doc.createElement( QStringLiteral( "gml:pos" ) );
originElem.appendChild( originPosElem );
QDomText originPosText = doc.createTextNode( qgsDoubleToString( QgsServerProjectUtils::floorWithPrecision( layerBBox.xMinimum(), precision ), precision ) + " " + qgsDoubleToString( QgsServerProjectUtils::floorWithPrecision( layerBBox.yMinimum(), precision ), precision ) );
originPosElem.appendChild( originPosText );
spatialDomainElem.appendChild( originElem );
rectGridElem.appendChild( originElem );

QDomElement xOffsetElem = doc.createElement( QStringLiteral( "gml:offsetVector" ) );
QDomText xOffsetText = doc.createTextNode( QString::number( layer->rasterUnitsPerPixelX() ) + " 0" );
xOffsetElem.appendChild( xOffsetText );
spatialDomainElem.appendChild( xOffsetElem );
rectGridElem.appendChild( xOffsetElem );

QDomElement yOffsetElem = doc.createElement( QStringLiteral( "gml:offsetVector" ) );
QDomText yOffsetText = doc.createTextNode( "0 " + QString::number( layer->rasterUnitsPerPixelY() ) );
yOffsetElem.appendChild( yOffsetText );
spatialDomainElem.appendChild( yOffsetElem );
rectGridElem.appendChild( yOffsetElem );

//GML property containing one RangeSet GML object.
QDomElement rangeSetElem = doc.createElement( QStringLiteral( "rangeSet" ) );
Expand All @@ -192,6 +193,11 @@ namespace QgsWcs
rsNameElem.appendChild( rsNameText );
RangeSetElem.appendChild( rsNameElem );

QDomElement rsLabelElem = doc.createElement( QStringLiteral( "label" ) );
QDomText rsLabelText = doc.createTextNode( QStringLiteral( "Bands" ) );
rsLabelElem.appendChild( rsLabelText );
RangeSetElem.appendChild( rsLabelElem );

QDomElement axisDescElem = doc.createElement( QStringLiteral( "axisDescription" ) );
RangeSetElem.appendChild( axisDescElem );

Expand All @@ -203,10 +209,15 @@ namespace QgsWcs
adNameElem.appendChild( adNameText );
AxisDescElem.appendChild( adNameElem );

QDomElement adLabelElem = doc.createElement( QStringLiteral( "label" ) );
QDomText adLablelText = doc.createTextNode( QStringLiteral( "bands" ) );
adLabelElem.appendChild( adLablelText );
AxisDescElem.appendChild( adLabelElem );

QDomElement adValuesElem = doc.createElement( QStringLiteral( "values" ) );
for ( int idx = 0; idx < layer->bandCount(); ++idx )
{
QDomElement adValueElem = doc.createElement( QStringLiteral( "value" ) );
QDomElement adValueElem = doc.createElement( QStringLiteral( "singleValue" ) );
QDomText adValueText = doc.createTextNode( QString::number( idx + 1 ) );
adValueElem.appendChild( adValueText );
adValuesElem.appendChild( adValueElem );
Expand Down
16 changes: 10 additions & 6 deletions tests/testdata/qgis_server/wcs_describecoverage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,26 @@ Content-Type: text/xml; charset=utf-8
<gml:high>3600 3600</gml:high>
</gml:GridEnvelope>
</gml:limits>
<gml:axisName>x</gml:axisName>
<gml:axisName>y</gml:axisName>
<gml:origin>
<gml:pos>-30 29.999999</gml:pos>
</gml:origin>
<gml:offsetVector>0.00833333 0</gml:offsetVector>
<gml:offsetVector>0 0.00833333</gml:offsetVector>
</gml:RectifiedGrid>
<gml:axisName>x</gml:axisName>
<gml:axisName>y</gml:axisName>
<gml:origin/>
<gml:offsetVector>0.00833333 0</gml:offsetVector>
<gml:offsetVector>0 0.00833333</gml:offsetVector>
</spatialDomain>
</domainSet>
<rangeSet>
<RangeSet>
<name>Bands</name>
<label>Bands</label>
<axisDescription>
<AxisDescription>
<name>bands</name>
<label>bands</label>
<values>
<value>1</value>
<singleValue>1</singleValue>
</values>
</AxisDescription>
</axisDescription>
Expand Down