Skip to content

Commit

Permalink
WMS server: list project crs, wgs84 and pseudo mercator in capabiliti…
Browse files Browse the repository at this point in the history
…es if no crs restriction is provided
  • Loading branch information
mhugent committed Jan 23, 2015
1 parent e22edc8 commit 7860138
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions src/server/qgsserverprojectparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -842,18 +842,31 @@ QStringList QgsServerProjectParser::supportedOutputCrsList() const
else
{
QDomElement wmsEpsgElem = propertiesElem.firstChildElement( "WMSEpsgList" );
if ( wmsEpsgElem.isNull() )
if ( !wmsEpsgElem.isNull() )
{
return crsList;
QDomNodeList valueList = wmsEpsgElem.elementsByTagName( "value" );
bool conversionOk;
for ( int i = 0; i < valueList.size(); ++i )
{
int epsgNr = valueList.at( i ).toElement().text().toInt( &conversionOk );
if ( conversionOk )
{
crsList.append( QString( "EPSG:%1" ).arg( epsgNr ) );
}
}
}
QDomNodeList valueList = wmsEpsgElem.elementsByTagName( "value" );
bool conversionOk;
for ( int i = 0; i < valueList.size(); ++i )
else
{
int epsgNr = valueList.at( i ).toElement().text().toInt( &conversionOk );
if ( conversionOk )
//no CRS restriction defined in the project. Provide project CRS, wgs84 and pseudo mercator
QString projectCrsId = projectCRS().authid();
crsList.append( projectCrsId );
if ( projectCrsId.compare( "EPSG:4326", Qt::CaseInsensitive ) != 0 )
{
crsList.append( QString( "EPSG:%1" ).arg( 4326 ) );
}
if ( projectCrsId.compare( "EPSG:3857", Qt::CaseInsensitive ) != 0 )
{
crsList.append( QString( "EPSG:%1" ).arg( epsgNr ) );
crsList.append( QString( "EPSG:%1" ).arg( 3857 ) );
}
}
}
Expand Down

0 comments on commit 7860138

Please sign in to comment.