GeoJSON – Include Point Feature with Unknown Coordinates

geojson

The Point I'd like to include is a marking on a historical map. Most of the items on the map have been located, so they make valid geoJSON Points. A few locations can not be identified, but I'd like to include them in the geoJSON file for completeness. As best I can tell, coordinates: [] and coordinates: null are rejected by geoJSON readers. Is there another option?

Best Answer

GeoJSON readers do not need to reject a geometry with an empty coordinate array, but they may do so:

https://www.rfc-editor.org/rfc/rfc7946#section-3.1

A GeoJSON Geometry object of any type other than "GeometryCollection" has a member with the name "coordinates". The value of the "coordinates" member is an array. The structure of the elements in this array is determined by the type of geometry. GeoJSON processors MAY interpret Geometry objects with empty "coordinates" arrays as null objects.

What GeoJSON readers you have been using? If empty geometries fit to the data model of the reader you could file a feature request for the program or library that you are using.

I am not sure if I interpret right the output of ogrinfo, but it seems to me that it understands that the following GeoJSON contains an empty point as a geometry.

GeoJSON:

{
"type": "FeatureCollection",

"features": [
{ "type": "Feature", "properties": null, "geometry": {"type":"Point","coordinates":[]} }
]

}

Output of ogrinfo:

ogrinfo point.json -al
INFO: Open of `point.json'
      using driver `GeoJSON' successful.

Layer name: point
Geometry: Unknown (any)
Feature Count: 1
Layer SRS WKT:
GEOGCRS["WGS 84",
    DATUM["World Geodetic System 1984",
        ELLIPSOID["WGS 84",6378137,298.257223563,
            LENGTHUNIT["metre",1]]],
    PRIMEM["Greenwich",0,
        ANGLEUNIT["degree",0.0174532925199433]],
    CS[ellipsoidal,2],
        AXIS["geodetic latitude (Lat)",north,
            ORDER[1],
            ANGLEUNIT["degree",0.0174532925199433]],
        AXIS["geodetic longitude (Lon)",east,
            ORDER[2],
            ANGLEUNIT["degree",0.0174532925199433]],
    ID["EPSG",4326]]
Data axis to CRS axis mapping: 2,1
OGRFeature(point):0