Skip to content

Feature without geometry is rejected #178

@janusw

Description

@janusw

GeoJSON.Net currently does not accept features that have no geometry member (when deserializing):

Newtonsoft.Json.JsonSerializationException: Required property 'geometry' not found in JSON.

The GeoJSON RFC says (see https://datatracker.ietf.org/doc/html/rfc7946#section-3.2):

   o  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.

So, an 'unlocated' feature with null geometry is indeed allowed.

While an absent/undefined geometry member is technically not mentioned here, I don't see much difference to a null geometry: In the end you have an unlocated feature without any geometry information.

So one could argue that this case is allowed by the GeoJSON RFC. And even if it was not allowed, the library could accept it as an extension (and generate an unlocated feature for it).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions