Invalid WFS geojson output when requesting propertyName

05-22-2022 10:02 PM
New Contributor II

It's been reported to me by a developer that when they are performing WFS getfeature requests on ArcGIS Servers (both 10.6.1 & 10.9.1) with PropertyName, an invalid geojson is returned (if requested as the output format). A propertyName request will result in a dangling comma in the geometry field (making in invalid). There appears to be an assumption in the geojson template that there will always be a "coordinate" in associated feature to fill in this section before the closing curly bracket.

Example WFS request:

Example Output:

(note "geometry":{"type":"MultiPolygon",},)

This doesn't appear to be an issue when outputting an xml file as the geometry field appears to be ignored:


Example Output:

<Topographic_Map_Indexes:General_Reference_Maps_Index_1Million gml:id="General_Reference_Maps_Index_1Million.1">

When testing a similar requests on geoserver, the result will return "null" for the "geometry" and continue to generate a valid json output.

Example request on geoserver:

Example Output:
{"type":"FeatureCollection","features":[{"type":"Feature","id":"ProcessingPlants.42000","geometry":null,"properties":{"ENO":42000,"PLANT_NAME":"Kwinana - Fe"}},{"type":"Feature","id":"ProcessingPlants.42096","geometry":null,"properties":{"ENO":42096,"PLANT_NAME":"Bell Bay"}},{"type":"Feature","id":"ProcessingPlants.42097","geometry":null,"properties":{"ENO":42097,"PLANT_NAME":"Bell Bay - Mn"}},

A work around has been found by not specifying the "&propertyName=" when querying ArcGIS servers, but I believe that the above is still a valid request and the servers should be able to handle a response without a coordinate.

I logged a call with our local ESRI support, but was advised that this was expected behaviour and to not use the "&propertyName=" option.

Just wondering if anyone where has any further ideas?

0 Kudos
1 Reply
New Contributor

Briefly: the response from a WFS, provided by ArcGIS Server in GeoJSON format does not follow the RFC 8259 and RFC 7946 standards, if the response is a standalone table (without geometry).

I have the same error as described above when retrieving standalone tables (without geometry) trough a WFS request in GeoJSON format.  The unexpected comma makes the JSON file invalid, so the systems that are willing to get the data from the web service are crashing unless they are ignoring the comma that is inserted against the RFC 8259 standard.

The request that KatAgnew provided as example is not including the "Shape" attribute, therefore the response is a standalone table without geometry, so the problem is not related to the fact that "&propertyName=" was used, but to the fact that a comma is added if the geometry is not present, as in the case of standalone tables.

If the "Shape" attribute is present, then the response looks like this one:


If the "Shape" attribute is not present, as in the case of standalone tables or when using "&propertyName=" parameter without listing the "Shape" attribute as a property name to be retrieved, the response looks like this one:

"geometry":{"type":"Unknown",}  - for standalone table

"geometry":{"type":"MultiPolygon",}  - for feature classes where Shape is not listed in the propertyName parameter.

This is not an expected behaviour, as the JSON is not valid according to RFC 8259, neither to not use the "&propertyName=" option or to not request standalone tables trough WFS.

The comma can be programmatically removed by ESRI, if quotation marks " are not following after the comma.

However "geometry":null seems to be the correct encoding and not the"geometry":{"type":"Unknown"}, as the geometry type is not unknown. It is known that the geometry is not provided in the case of a standalone table.


Relevant discussions about this topic:

In the above discussions, Clemens Portele mentioned:

"Yes, features that do not have a geometry are valid. In GeoJSON the geometry member is set to null for these features."

This is inline with the GeoJSON format standard (RFC 7946), where in section 3.2 it is written:

A Feature object has a member with the name "geometry". The value of the geometry member SHALL be either a Geometry object as defined above or, in the case that the Feature is unlocated, a JSON null value.