Skip to content

Commit b54d279

Browse files
committedSep 22, 2015
[Server][BUGFIX] Resolve relative pathes (SVGMArker, Netcdf, etc)
QGIS-Server has some trouble to resolve relative pathes. For example, SVGMarker path and NETCDF datasource are not resolved in QGIS Server unlike in QGIS Desktop. To resolve relative path for SVGMarker, the class QgsSombolLayerV2Utils is used and it based on QgsProject::instance()->fileName(). To resolve relative path for NETCDF datasource and other GDAL datasources, the class QgsMapLayer is used and it based on QgsProject::instance()->readPath( filename ). To fix the issue, the QgsProject instance fileName is set in the QgsServerProjectParser constructor.
1 parent ce62640 commit b54d279

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
 

‎src/server/qgsserverprojectparser.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ QgsServerProjectParser::QgsServerProjectParser( QDomDocument* xmlDoc, const QStr
7676
}
7777
}
7878
}
79+
// Setting the QgsProject instance fileName
80+
// to help converting relative pathes to absolute
81+
if ( mProjectPath != "" )
82+
{
83+
QgsProject::instance()->setFileName( mProjectPath );
84+
}
7985
}
8086

8187
QgsServerProjectParser::QgsServerProjectParser()
@@ -169,6 +175,8 @@ QgsMapLayer* QgsServerProjectParser::createLayerFromElement( const QDomElement&
169175
QDomElement dataSourceElem = elem.firstChildElement( "datasource" );
170176
QString uri = dataSourceElem.text();
171177
QString absoluteUri;
178+
// If QgsProject instance fileName is set,
179+
// Is converting relative pathes to absolute still relevant ?
172180
if ( !dataSourceElem.isNull() )
173181
{
174182
//convert relative pathes to absolute ones if necessary

0 commit comments

Comments
 (0)
Please sign in to comment.