PS: QGIS server adds the id when creating the GeoJSON for a GetFeature request [1].
giovanni [1] https://github.com/qgis/QGIS/blob/master/src/server/services/wfs/qgswfsgetfeature.cpp#L994 Il 9 ott 2017 18:13, "G. Allegri" <[email protected]> ha scritto: > HI all, > GeoJSON RFC7946 states that "If a Feature has a commonly used identifier, > that identifier SHOULD be included as a member of the Feature object with > the name "id", and the value of this member is either a JSON string or > number". For example OpenLayers tries to parse the id field to uniquely > identify the features inside a GeoJSON feature collection. > I've digged how OGR GeoJSON driver treats FIDs during serialization and it > seems that it will write it if the OGrFeature has the FID field set [2], > but AFAICS QIGS OGR provider doesn't set it unless "the first attribute > is the FID and the user has set it". Well, this condition depends on [4], > and now I odn't understand how this applies to a QGIS layer being exported > to GeoJSON. > > Questions: > - is there a way to force the OGR provider setting the FID? > - could the OGR provider have an option to force it from the export > window, like Mapserver does with the USE_FEATUREID option for its output > format > > *?* > giovanni > > [1] https://tools.ietf.org/html/rfc7946#page-11 > [2] https://github.com/OSGeo/gdal/blob/trunk/gdal/ogr/ogrsf_frmts/geojson/ > ogrgeojsonwriter.cpp#L601 > [3] https://github.com/qgis/QGIS/blob/master/src/providers/ogr/ > qgsogrprovider.cpp#L1269 > [4] https://github.com/qgis/QGIS/blob/master/src/providers/ogr/ > qgsogrprovider.cpp#L894 > [5] http://mapserver.org/output/ogr_output.html#table-of-contents >
_______________________________________________ QGIS-Developer mailing list [email protected] List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
