Skip to content
Permalink
Browse files

qgis wfs server cannot serve geometryless tables

http://hub.qgis.org/issues/7534

In a project where there are geometryless tables everything seems to allow publish them with qgis wfs server. In the project/layer properties all the proper panels (ex. OWS server) seems to allow this operation, but then when accessing the wfs service with the WFS client, the table is not added correctly in the project. In the TOC shows a strange icon (instead the expected table icon) and the table of attributes is empty.

In the client the support for geometryless wfs tables should be available since

http://hub.qgis.org/projects/quantum-gis/repository/revisions/aedddc22b11e26df900d1ff91d6d23c94d905c78

so it is a server issue.
  • Loading branch information
rldhont committed Apr 19, 2013
1 parent 032b4ad commit 92d24fb12047652142d4eda69c3a2b8c261aac4f
Showing with 32 additions and 17 deletions.
  1. +3 −0 src/mapserver/qgsprojectparser.cpp
  2. +29 −17 src/mapserver/qgswfsserver.cpp
@@ -314,6 +314,8 @@ void QgsProjectParser::describeFeatureType( const QString& aTypeName, QDomElemen
QDomElement geomElem = doc.createElement( "element"/*xsd:element*/ );
geomElem.setAttribute( "name", "geometry" );
QGis::WkbType wkbType = layer->wkbType();
if ( wkbType != QGis::WKBNoGeometry )
{
switch ( wkbType )
{
case QGis::WKBPoint25D:
@@ -347,6 +349,7 @@ void QgsProjectParser::describeFeatureType( const QString& aTypeName, QDomElemen
geomElem.setAttribute( "minOccurs", "0" );
geomElem.setAttribute( "maxOccurs", "1" );
sequenceElem.appendChild( geomElem );
}

const QgsFields& fields = provider->fields();
for ( int idx = 0; idx < fields.count(); ++idx )
@@ -815,14 +815,18 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format
}
else if ( expFilterOk )
{
QgsFeatureIterator fit = layer->getFeatures( QgsFeatureRequest()
.setFilterRect( searchRect )
.setFlags( QgsFeatureRequest::ExactIntersect | ( mWithGeom ? QgsFeatureRequest::NoFlags : QgsFeatureRequest::NoGeometry ) )
.setSubsetOfAttributes( attrIndexes ) );
QgsFeatureRequest req;
req.setSubsetOfAttributes( attrIndexes );
if ( layer->wkbType() != QGis::WKBNoGeometry )
{
req.setFilterRect( searchRect )
.setFlags( QgsFeatureRequest::ExactIntersect | ( mWithGeom ? QgsFeatureRequest::NoFlags : QgsFeatureRequest::NoGeometry ) );
}
QgsFeatureIterator fit = layer->getFeatures( req );
QgsExpression *mFilter = new QgsExpression( expFilter );
if ( mFilter->hasParserError() )
{
throw QgsMapServiceException( "RequestNotWellFormed", mFilter->parserErrorString() );
throw QgsMapServiceException( "RequestNotWellFormed",QString( "Expression filter error message: %1." ).arg( mFilter->parserErrorString() ) );
}
if ( mFilter )
{
@@ -831,7 +835,7 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format
QVariant res = mFilter->evaluate( &feature, fields );
if ( mFilter->hasEvalError() )
{
throw QgsMapServiceException( "RequestNotWellFormed", mFilter->evalErrorString() );
throw QgsMapServiceException( "RequestNotWellFormed", QString( "Expression filter eval error message: %1." ).arg( mFilter->evalErrorString() ) );
}
if ( res.toInt() != 0 )
{
@@ -921,20 +925,24 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format
QgsExpression *mFilter = QgsOgcUtils::expressionFromOgcFilter( filterElem );
if ( mFilter->hasParserError() )
{
throw QgsMapServiceException( "RequestNotWellFormed", mFilter->parserErrorString() );
throw QgsMapServiceException( "RequestNotWellFormed", QString( "OGC expression filter error message: %1." ).arg( mFilter->parserErrorString() ) );
}
if ( mFilter )
{
QgsFeatureIterator fit = layer->getFeatures( QgsFeatureRequest()
.setFilterRect( searchRect )
.setFlags( QgsFeatureRequest::ExactIntersect | ( mWithGeom ? QgsFeatureRequest::NoFlags : QgsFeatureRequest::NoGeometry ) )
.setSubsetOfAttributes( attrIndexes ) );
QgsFeatureRequest req;
req.setSubsetOfAttributes( attrIndexes );
if ( layer->wkbType() != QGis::WKBNoGeometry )
{
req.setFilterRect( searchRect )
.setFlags( QgsFeatureRequest::ExactIntersect | ( mWithGeom ? QgsFeatureRequest::NoFlags : QgsFeatureRequest::NoGeometry ) );
}
QgsFeatureIterator fit = layer->getFeatures( req );
while ( fit.nextFeature( feature ) && featureCounter < maxFeat )
{
QVariant res = mFilter->evaluate( &feature, fields );
if ( mFilter->hasEvalError() )
{
throw QgsMapServiceException( "RequestNotWellFormed", mFilter->evalErrorString() );
throw QgsMapServiceException( "RequestNotWellFormed", QString( "OGC expression filter eval error message: %1." ).arg( mFilter->evalErrorString() ) );
}
if ( res.toInt() != 0 )
{
@@ -952,10 +960,14 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format
}
else
{
QgsFeatureIterator fit = layer->getFeatures( QgsFeatureRequest()
.setFilterRect( searchRect )
.setFlags( QgsFeatureRequest::ExactIntersect | ( mWithGeom ? QgsFeatureRequest::NoFlags : QgsFeatureRequest::NoGeometry ) )
.setSubsetOfAttributes( attrIndexes ) );
QgsFeatureRequest req;
req.setSubsetOfAttributes( attrIndexes );
if ( layer->wkbType() != QGis::WKBNoGeometry )
{
req.setFilterRect( searchRect )
.setFlags( QgsFeatureRequest::ExactIntersect | ( mWithGeom ? QgsFeatureRequest::NoFlags : QgsFeatureRequest::NoGeometry ) );
}
QgsFeatureIterator fit = layer->getFeatures( req );
while ( fit.nextFeature( feature ) && featureCounter < maxFeat )
{
if ( featureCounter == 0 )
@@ -975,7 +987,7 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format

}
if ( featureCounter == 0 )
throw QgsMapServiceException( "RequestNotWellFormed", mErrors.join( ". " ) );
throw QgsMapServiceException( "RequestNotWellFormed", QString( "No feature found error messages: %1." ).arg( mErrors.join( ". " ) ) );
else
endGetFeature( request, format );

0 comments on commit 92d24fb

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