3

Does the order of geometries/features in GeometryCollection/FeatureCollection matter? There is a point in GeoJSON RFC (last point) about order but I could not get fully:

The word "Collection" in "FeatureCollection" and "GeometryCollection" does not have any significance for the semantics of array members. The "features" and "geometries" members, respectively, of these objects are standard ordered JSON arrays, not unordered sets.

Are following two geometries to be considered equal or not

{
  "type":"GeometryCollection",
  "geometries":[
    {"type":"Point","coordinates":[1.0,1.0]},
    {"type":"Point","coordinates":[2.0,2.0]}
  ]
}

{ "type":"GeometryCollection", "geometries":[ {"type":"Point","coordinates":[2.0,2.0]}, {"type":"Point","coordinates":[1.0,1.0]} ] }

If collection should be ordered list then what geometry operation on collection may give different result in case geometries' order is reversed?

Gagan
  • 201
  • 2
  • 5
  • If they are "not unordered sets", I would interpret that to mean that they are ordered sets, in which case your example is of unequal features. – Vince Jan 21 '18 at 17:11
  • 1
    Thanks @Vince, but I could not get, why does order matter, If in a geometry collection I add a geometries in reverse order, the out put geometry collection should be equal. Just my point of view. Or in another way what geometry operation on collection may give different result if geometries order are reversed? – Gagan Jan 21 '18 at 17:30
  • Please ask this also on the GeoJSON mailing list, I would like to see an authorized answer. – user30184 Jan 21 '18 at 17:58
  • Just to make sure if the interpretation in GeoJSON is different from OGC Simple Features standard: By the nature of digital representations, collections are inherently ordered by the underlying storage mechanism. Two collections whose difference is only this order are spatially equal and will return equivalent results in any geometric-defined operations. – user30184 Jan 21 '18 at 18:09
  • Please do not ask further questions in comments. No one can convincingly answer Why was it done this way? without a definitive source, and Why does it matter? is a more philosophical issue, incompatible with GIS SE's Focused Q&A model. – Vince Jan 21 '18 at 18:26
  • 1
    I feel obliged to add: there may arise cases where order can be of substantial importance, e.g. when constructing geometries of higher dimension. constructed lines from these two point sets will have different orientations if you read them out sequentially, and might be rendered completely useles when multiple points end up in mixed order between sources. – geozelot Jan 21 '18 at 19:04
  • @thingumaBob It might be unwise to make a system that relies on such ordered members inside GeometryCollection because any program that implement OGC Simple Feature Access may mix the order any time. But if the data provider and production chain are well known and trusted then perhaps it can work well. – user30184 Jan 21 '18 at 20:21
  • @user30184 sure, and my sidenote might have been a little off-topic here, but since e.g. web mapping does rely heavily on (spatial) JSON (where one cannot always choose the source's formatting) for all sorts of 'geometry operations' I thought this was due to mention. – geozelot Jan 21 '18 at 20:39
  • @Vince Modified question as per your suggestion. – Gagan Jan 22 '18 at 04:51

0 Answers0