[mapserver-users] Geojson output from WFS is missing ID

Even Rouault even.rouault at spatialys.com
Tue May 10 03:19:06 PDT 2016


Le mardi 10 mai 2016 12:08:07, Rahkonen Jukka (MML) a écrit :
> Hi,
> 
> WFS output from Mapserver 7.0 in GML contain gml:id
> <ms:msGeometry><gml:Polygon gml:id="states.1"
> srsName="urn:ogc:def:crs:EPSG::4326">

It looks like you must use WFS 2.0 and/or GML 3.2 output. In that case the GML 
3.2 schemas require each geometry to have a gml:id. So this is a geometry id, 
not a feature id ( in case of geometry collections, you'll have one id for the 
collection and as many ids as members) To address that technical requirement, 
MapServer generates it in a sequential way for the output of each request. Not 
completely sure it matches the uniqueness intended but at least it validates 
schemas. So this particular one is not a good candidate to be exported to 
other formats, but I see Thomas has just replied for the feature id.

> 
> However, with GeoJSON as outputformat the id is missing:
> {
> "type": "FeatureCollection",
> "crs": { "type": "name", "properties": { "name":
> "urn:ogc:def:crs:OGC:1.3:CRS84" } }, "features": [
> { "type": "Feature", "properties": { "PK_UID": 1, "STATE_NAME": "Illinois",
> 
> 
> GeoJSON specification says in
> http://geojson.org/geojson-spec.html#feature-objects: "If a feature has a
> commonly used identifier, that identifier should be included as a member
> of the feature object with the name "id"."
> 
> GeoJSON from Geoserver WFS does contain the id:
> 
> {"type":"FeatureCollection","totalFeatures":49,"features":[{"type":"Feature
> ","id":"states.1","geometry":{"type":"MultiPolygon"
> 
> Should this be classified as a bug or a candidate for a featere request?
> 
> -Jukka Rahkonen-

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the mapserver-users mailing list