mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-01 00:46:20 -05:00
[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:
parent
1e3b820da4
commit
e3a832c29e
@ -760,6 +760,12 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format
|
|||||||
{
|
{
|
||||||
mPropertyName = pnIt.value();
|
mPropertyName = pnIt.value();
|
||||||
}
|
}
|
||||||
|
mGeometryName = "";
|
||||||
|
QMap<QString, QString>::const_iterator gnIt = mParameters.find( "GEOMETRYNAME" );
|
||||||
|
if ( gnIt != mParameters.end() )
|
||||||
|
{
|
||||||
|
mGeometryName = gnIt.value().toUpper();
|
||||||
|
}
|
||||||
|
|
||||||
mTypeNames = mTypeName.split( "," );
|
mTypeNames = mTypeName.split( "," );
|
||||||
foreach ( const QString &tnStr, mTypeNames )
|
foreach ( const QString &tnStr, mTypeNames )
|
||||||
@ -1683,7 +1689,7 @@ QString QgsWFSServer::createFeatureGeoJSON( QgsFeature* feat, int prec, QgsCoord
|
|||||||
fStr += ",\n";
|
fStr += ",\n";
|
||||||
|
|
||||||
QgsGeometry* geom = feat->geometry();
|
QgsGeometry* geom = feat->geometry();
|
||||||
if ( geom && mWithGeom )
|
if ( geom && mWithGeom && mGeometryName != "NONE" )
|
||||||
{
|
{
|
||||||
QgsRectangle box = geom->boundingBox();
|
QgsRectangle box = geom->boundingBox();
|
||||||
|
|
||||||
@ -1747,7 +1753,7 @@ QDomElement QgsWFSServer::createFeatureGML2( QgsFeature* feat, QDomDocument& doc
|
|||||||
typeNameElement.setAttribute( "fid", mTypeName + "." + QString::number( feat->id() ) );
|
typeNameElement.setAttribute( "fid", mTypeName + "." + QString::number( feat->id() ) );
|
||||||
featureElement.appendChild( typeNameElement );
|
featureElement.appendChild( typeNameElement );
|
||||||
|
|
||||||
if ( mWithGeom )
|
if ( mWithGeom && mGeometryName != "NONE" )
|
||||||
{
|
{
|
||||||
//add geometry column (as gml)
|
//add geometry column (as gml)
|
||||||
QgsGeometry* geom = feat->geometry();
|
QgsGeometry* geom = feat->geometry();
|
||||||
@ -1806,7 +1812,7 @@ QDomElement QgsWFSServer::createFeatureGML3( QgsFeature* feat, QDomDocument& doc
|
|||||||
typeNameElement.setAttribute( "gml:id", mTypeName + "." + QString::number( feat->id() ) );
|
typeNameElement.setAttribute( "gml:id", mTypeName + "." + QString::number( feat->id() ) );
|
||||||
featureElement.appendChild( typeNameElement );
|
featureElement.appendChild( typeNameElement );
|
||||||
|
|
||||||
if ( mWithGeom )
|
if ( mWithGeom && mGeometryName != "NONE" )
|
||||||
{
|
{
|
||||||
//add geometry column (as gml)
|
//add geometry column (as gml)
|
||||||
QgsGeometry* geom = feat->geometry();
|
QgsGeometry* geom = feat->geometry();
|
||||||
|
@ -95,6 +95,7 @@ class QgsWFSServer: public QgsOWSServer
|
|||||||
/* The list of Feature's Type requested */
|
/* The list of Feature's Type requested */
|
||||||
QStringList mTypeNames;
|
QStringList mTypeNames;
|
||||||
QString mPropertyName;
|
QString mPropertyName;
|
||||||
|
QString mGeometryName;
|
||||||
bool mWithGeom;
|
bool mWithGeom;
|
||||||
/* Error messages */
|
/* Error messages */
|
||||||
QStringList mErrors;
|
QStringList mErrors;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user