Closed airbreather closed 4 years ago
I see your point
This was also discussed when we designed the format.
The result was that the subgeometries in a geomoetrycollection is "complete twkb geometries". In other words, each subgeometry has it's own absolute starting value.
But for multigeometries like multipoint, multiline and multipolygon it is only one absolute value in the beginning.
This can be seen in the PostGIS-implementation:
SELECT
length(
st_astwkb(
'multipoint((1000000 1000000),(1000001 1000001))'::geometry
)
)
which gives a twkb length of 11 bytes while the corresponding geoemtry collection:
SELECT
length(
st_astwkb(
'geometrycollection(point(1000000 1000000),point(1000001 1000001))'::geometry
)
)
gives a twkb-length of 19 bytes.
The reason was if I recall correct mostly was that it is easier to implement this way. When creating or reading a geometry-collection it just iterates a bunch of geometries that is complete. The function for reading a polygon from a geometrycollection is the same as the function reading a plain polygon.
I have added a note in the specification to clearify. Does this help?
I have added a note in the specification to clearify. Does this help?
Yes, thanks for the clarification. Closing.
https://github.com/TWKB/Specification/blob/351dd1e1de0629a9dc2e49dab26bf70faea93b8c/twkb.md#calculate-delta-values says this:
https://github.com/TWKB/Specification/blob/351dd1e1de0629a9dc2e49dab26bf70faea93b8c/twkb.md#geometrycollection-type-7 says this:
This creates an apparent ambiguity: if a GeometryCollection contains a Polygon followed by a Linestring, then is the first coordinate of the Linestring treated as: