I've searched both the 2008 spec and RFC7946 and can't find anything about when two GeoJSON objects would be considered equal. I wonder if anyone can enlighten me?
It seems to me the options are:
Two GeoJSON objects that contain the same geometry are never equal, and are both distinctly unique features.
Two GeoJSON objects are equivalent if their geometry coordinates are exactly equal, irrespective of their geometry type.
Two GeoJSON objects are equivalent only if their geometry - both coordinates and type are exactly equal.
Option 1 poses questions on handling assertions about the same geometry from multiple sources, as well as uniquely identifying them.
Option 2 poses questions regarding handling multiple geometry type declarations, which effectively becomes a multi-valued property
Option 3 poses questions about a GeometryCollection asserting multiple geometries that contain the same coordinates but different types
The GeoJSON-LD proposals appears to suggest a combination of all three options are possible via @id, which means equality is outside of the RFC spec and not defined without an external property.
I have been encoding all my geometries as unique base64 data:urls
with the polyline algorithm which works well, and have allowed geometry type to be multi-valued and merged all other properties.
My thinking is both the properties
object and any foreign members are explicitly outside of the spec so can be safely merged, though I'm not sure how correct the semantics of that are.
Example below:
[{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [[123,456],[456,789],[789,012],[012,234]]
}
"properties": {
"name": "Bob",
},
},
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [[123,456],[456,789],[789,012],[012,234]]
}
"properties": {
"name": "Jane",
},
},
"type": "Feature",
"geometry": {
"type": "MultiPoint",
"coordinates": [[123,456],[456,789],[789,012],[012,234]]
}
"properties": {
"name": "Fred",
},
},
"type": "GeometryCollection",
"geometries" : {
{
"type": "Polygon",
"coordinates": [[123,456],[456,789],[789,012],[012,234]]
},
{
"type": "MultiPoint",
"coordinates": [[123,456],[456,789],[789,012],[012,234]]
}
}
"properties": {
"name": "Mary",
},
}]
I don't have the rep to add tags for JSON-LD or GeoJSON-LD, perhaps someone else could for me.