Skip to content

Commit

Permalink
[FEATURE][SERVER] GetFeature without geometry
Browse files Browse the repository at this point in the history
You can add an extra parameter GeometryName with the value to NONE or None or
 none in GetFeature WFS Request to only have fields.
  • Loading branch information
rldhont committed May 21, 2015
1 parent 1e3b820 commit e3a832c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/server/qgswfsserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions src/server/qgswfsserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e3a832c

Please sign in to comment.