Skip to content

Associate properties with a particular geometry #27

@aznan2

Description

@aznan2

While GeoJSON doesn't disallow geometries to be placed in a Feature's "properties" property, the Feature's main geometry must be placed in the "geometry" property. Any other geometries are mostly ignored by readers. Often, this constraint is too restrictive: a single real world object may consist of several different geometries, none of which is a "main" geometry, and each with its own set of information tied to it.

This is one possible way to go about it:

Apart from a geometry object or null, a Feature's "where" property may instead be an array of geometry references. A geometry reference takes the form of a JSON Pointer which points to a geometry placed somewhere else in the Feature object. As JSON Pointers always start at the document root, moving a Feature into a FeatureCollection necessitates updating all its geometry references. To prevent this, a Relative JSON Pointer may be used instead.

Example - Click to expand

A real property that consists of two areas. One area is a normal land area and the other is an area on water, represented by lines following a stream. The stream has a fork in it, with each fork's geometry collected at a different time, with different precision.

{
  "type": "Feature",
  "id": "b66a6e18-d6cc-48ee-80ee-f93d6406392c",
  "geometry": null,
  "where": [
    "1/properties/areas/0/geometries/0/position",
    "1/properties/areas/1/geometries/0/position",
    "1/properties/areas/1/geometries/1/position"
  ],
  "properties": {
    "realPropertyName": "Fiskefastigheten 1:1",
    "areas": [
      {
        "type": "land area",
        "livableArea": 89.5,
        "geometries": [
          {
            "position": {
              "type": "Polygon",
              "coordinates": [
                [
                  [100, 100],
                  [100, 200],
                  [200, 200],
                  [200, 100],
                  [100, 100]
                ]
              ]
            },
            "timeOfCollection": "2021-11-23T15:19:43.123Z",
            "positionAccuracy": 0.1
          }
        ]
      },
      {
        "type": "water area",
        "livableArea": 0,
        "geometries": [
          {
            "position": {
              "type": "LineString",
              "coordinates": [
                [100, 300],
                [100, 400]
              ]
            },
            "timeOfCollection": "2021-11-23T17:01:33.123Z",
            "positionAccuracy": 0.1
          },
          {
            "position": {
              "type": "LineString",
              "coordinates": [
                [100, 350],
                [150, 400]
              ]
            },
            "timeOfCollection": "2003-05-06T12:13:51.123Z",
            "positionAccuracy": 0.25
          }
        ]
      }
    ]
  }
}

Better than nothing, but that approach does not solve for cases where information should be associated with part of a geometry - for instance, data related to a single wall of a building polyhedron or where you want accuracy metadata for each point of a polygon. In that case, it may be better to keep the geometries in the "where" property and reference them from the properties instead.

I would love to hear thoughts and ideas about this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    future workA proposal or requirement that will or may be addressed in a future work item

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions