[Qgis-developer] [QGIS-Server] Relative paths and QGIS-Server

Marco Hugentobler marco.hugentobler at sourcepole.ch
Mon Sep 21 18:29:31 PDT 2015


Hi René-Luc

Setting the QgsProject instance FileName will be fine. Just make sure it 
is set at each request.

cheers,
Marco

Am 21.09.2015 um 15:07 schrieb René-Luc Dhont:
> Hi Devs,
> Hi Marco,
>
> I encounter some troubles with relative paths and QGIS-Server. 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 ).
>
> QGIS Server uses the QgsServerProjectParser to convert relative path 
> to absolute path. This mean that it parses the project and update paths.
>
> To fixe this issue, we have 2 solutions :
> * Set the QgsProject instance FileName in the QgsServerProjectParser
> * Update QgsServerProjectParser::createLayerFromElement to resolve and 
> update SVGMarker path and GDAL datasources
>
> Marco, I'dlike to have your point of view to fix it.
>
> Regards,


-- 
Dr. Marco Hugentobler
Sourcepole -  Linux & Open Source Solutions
Weberstrasse 5, CH-8004 Zürich, Switzerland
marco.hugentobler at sourcepole.ch http://www.sourcepole.ch
Technical Advisor QGIS Project Steering Committee



More information about the Qgis-developer mailing list