[FEATURE][SERVER] GetFeature without geometry

You can add an extra parameter GeometryName with the value to NONE or None or
 none in GetFeature WFS Request to only have fields.
This commit is contained in:
rldhont 2015-05-21 13:09:46 +02:00
parent 1e3b820da4
commit e3a832c29e
2 changed files with 10 additions and 3 deletions

View File

@ -760,6 +760,12 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format
{
mPropertyName = pnIt.value();
}
mGeometryName = "";
QMap<QString, QString>::const_iterator gnIt = mParameters.find( "GEOMETRYNAME" );
if ( gnIt != mParameters.end() )
{
mGeometryName = gnIt.value().toUpper();
}
mTypeNames = mTypeName.split( "," );
foreach ( const QString &tnStr, mTypeNames )
@ -1683,7 +1689,7 @@ QString QgsWFSServer::createFeatureGeoJSON( QgsFeature* feat, int prec, QgsCoord
fStr += ",\n";
QgsGeometry* geom = feat->geometry();
if ( geom && mWithGeom )
if ( geom && mWithGeom && mGeometryName != "NONE" )
{
QgsRectangle box = geom->boundingBox();
@ -1747,7 +1753,7 @@ QDomElement QgsWFSServer::createFeatureGML2( QgsFeature* feat, QDomDocument& doc
typeNameElement.setAttribute( "fid", mTypeName + "." + QString::number( feat->id() ) );
featureElement.appendChild( typeNameElement );
if ( mWithGeom )
if ( mWithGeom && mGeometryName != "NONE" )
{
//add geometry column (as gml)
QgsGeometry* geom = feat->geometry();
@ -1806,7 +1812,7 @@ QDomElement QgsWFSServer::createFeatureGML3( QgsFeature* feat, QDomDocument& doc
typeNameElement.setAttribute( "gml:id", mTypeName + "." + QString::number( feat->id() ) );
featureElement.appendChild( typeNameElement );
if ( mWithGeom )
if ( mWithGeom && mGeometryName != "NONE" )
{
//add geometry column (as gml)
QgsGeometry* geom = feat->geometry();

View File

@ -95,6 +95,7 @@ class QgsWFSServer: public QgsOWSServer
/* The list of Feature's Type requested */
QStringList mTypeNames;
QString mPropertyName;
QString mGeometryName;
bool mWithGeom;
/* Error messages */
QStringList mErrors;