Skip to content
Permalink
Browse files

Use pk as WFS id in GeoJSON export

  • Loading branch information
mhugent committed Feb 19, 2018
1 parent b3eaede commit 26cf3172e6960c7326c6720fa5a6a86ede9767c2
Showing with 6 additions and 4 deletions.
  1. +4 −3 src/server/qgswfsserver.cpp
  2. +2 −1 src/server/qgswfsserver.h
@@ -1377,7 +1377,7 @@ void QgsWFSServer::setGetFeature( QgsRequestHandler& request, const QString& for
fcString += " ";
else
fcString += " ,";
fcString += createFeatureGeoJSON( feat, prec, crs, attrIndexes, excludedAttributes );
fcString += createFeatureGeoJSON( feat, prec, crs, attrIndexes, excludedAttributes, pkAttributes );
fcString += "\n";

result = fcString.toUtf8();
@@ -1926,9 +1926,10 @@ QgsFeatureIds QgsWFSServer::getFeatureIdsFromFilter( const QDomElement& filterEl
return fids;
}

QString QgsWFSServer::createFeatureGeoJSON( QgsFeature* feat, int prec, QgsCoordinateReferenceSystem& crs, const QgsAttributeList& attrIndexes, const QSet<QString>& excludedAttributes ) /*const*/
QString QgsWFSServer::createFeatureGeoJSON( QgsFeature* feat, int prec, QgsCoordinateReferenceSystem& crs, const QgsAttributeList& attrIndexes, const QSet<QString>& excludedAttributes,
const QgsAttributeList& pkAttributes ) /*const*/
{
QString id = QString( "%1.%2" ).arg( mTypeName, FID_TO_STRING( feat->id() ) );
QString id = QString( "%1.%2" ).arg( mTypeName, featureGmlId( feat, pkAttributes ) );

QgsJSONExporter exporter;
exporter.setSourceCrs( crs );
@@ -120,7 +120,8 @@ class QgsWFSServer: public QgsOWSServer
QgsFeatureIds getFeatureIdsFromFilter( const QDomElement& filter, QgsVectorLayer* layer );

//methods to write GeoJSON
QString createFeatureGeoJSON( QgsFeature* feat, int prec, QgsCoordinateReferenceSystem& crs, const QgsAttributeList& attrIndexes, const QSet<QString>& excludedAttributes ) /*const*/;
QString createFeatureGeoJSON( QgsFeature* feat, int prec, QgsCoordinateReferenceSystem& crs, const QgsAttributeList& attrIndexes, const QSet<QString>& excludedAttributes,
const QgsAttributeList& pkAttributes = QgsAttributeList() ) /*const*/;

//methods to write GML2
QDomElement createFeatureGML2( QgsFeature* feat, QDomDocument& doc, int prec, QgsCoordinateReferenceSystem& crs, const QgsAttributeList& attrIndexes, const QSet<QString>& excludedAttributes,

0 comments on commit 26cf317

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