Skip to content
Permalink
Browse files

Fix bug #6582: QGIS server displayes text layers only with absolute p…

…athes
  • Loading branch information
mhugent committed Nov 7, 2012
1 parent e15f4a8 commit 5f19c6b31923114886fa44a6f99a733acf1f8f19
Showing with 19 additions and 0 deletions.
  1. +19 −0 src/mapserver/qgsprojectparser.cpp
@@ -41,6 +41,7 @@
#include <QSvgRenderer>
#include <QTextDocument>
#include "QTextStream"
#include <QUrl>


QgsProjectParser::QgsProjectParser( QDomDocument* xmlDoc, const QString& filePath ): QgsConfigParser(), mXMLDoc( xmlDoc ), mProjectPath( filePath )
@@ -1305,6 +1306,24 @@ QgsMapLayer* QgsProjectParser::createLayerFromElement( const QDomElement& elem,
}
}
}
else if ( uri.startsWith( "file:" ) ) //a file based datasource in url notation (e.g. delimited text layer)
{
QString filePath = uri.mid( 5, uri.indexOf( "?" ) - 5 );
QString absoluteFilePath = convertToAbsolutePath( filePath );
if ( filePath != absoluteFilePath )
{
QUrl destUrl = QUrl::fromEncoded( uri.toAscii() );
destUrl.setScheme( "file" );
destUrl.setPath( absoluteFilePath );
absoluteUri = destUrl.toEncoded();
QDomText absoluteTextNode = mXMLDoc->createTextNode( absoluteUri );
dataSourceElem.replaceChild( absoluteTextNode, dataSourceElem.firstChild() );
}
else
{
absoluteUri = uri;
}
}
else //file based data source
{
absoluteUri = convertToAbsolutePath( uri );

0 comments on commit 5f19c6b

Please sign in to comment.
You can’t perform that action at this time.