Skip to content

Commit e3a832c

Browse files
committedMay 21, 2015
[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.
1 parent 1e3b820 commit e3a832c

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed
 

‎src/server/qgswfsserver.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,12 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format
760760
{
761761
mPropertyName = pnIt.value();
762762
}
763+
mGeometryName = "";
764+
QMap<QString, QString>::const_iterator gnIt = mParameters.find( "GEOMETRYNAME" );
765+
if ( gnIt != mParameters.end() )
766+
{
767+
mGeometryName = gnIt.value().toUpper();
768+
}
763769

764770
mTypeNames = mTypeName.split( "," );
765771
foreach ( const QString &tnStr, mTypeNames )
@@ -1683,7 +1689,7 @@ QString QgsWFSServer::createFeatureGeoJSON( QgsFeature* feat, int prec, QgsCoord
16831689
fStr += ",\n";
16841690

16851691
QgsGeometry* geom = feat->geometry();
1686-
if ( geom && mWithGeom )
1692+
if ( geom && mWithGeom && mGeometryName != "NONE" )
16871693
{
16881694
QgsRectangle box = geom->boundingBox();
16891695

@@ -1747,7 +1753,7 @@ QDomElement QgsWFSServer::createFeatureGML2( QgsFeature* feat, QDomDocument& doc
17471753
typeNameElement.setAttribute( "fid", mTypeName + "." + QString::number( feat->id() ) );
17481754
featureElement.appendChild( typeNameElement );
17491755

1750-
if ( mWithGeom )
1756+
if ( mWithGeom && mGeometryName != "NONE" )
17511757
{
17521758
//add geometry column (as gml)
17531759
QgsGeometry* geom = feat->geometry();
@@ -1806,7 +1812,7 @@ QDomElement QgsWFSServer::createFeatureGML3( QgsFeature* feat, QDomDocument& doc
18061812
typeNameElement.setAttribute( "gml:id", mTypeName + "." + QString::number( feat->id() ) );
18071813
featureElement.appendChild( typeNameElement );
18081814

1809-
if ( mWithGeom )
1815+
if ( mWithGeom && mGeometryName != "NONE" )
18101816
{
18111817
//add geometry column (as gml)
18121818
QgsGeometry* geom = feat->geometry();

‎src/server/qgswfsserver.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ class QgsWFSServer: public QgsOWSServer
9595
/* The list of Feature's Type requested */
9696
QStringList mTypeNames;
9797
QString mPropertyName;
98+
QString mGeometryName;
9899
bool mWithGeom;
99100
/* Error messages */
100101
QStringList mErrors;

0 commit comments

Comments
 (0)
Please sign in to comment.