georust / geozero

Zero-Copy reading and writing of geospatial data.
Apache License 2.0
321 stars 30 forks source link

`point_begin`/`point_end` should be called around `xy` for each Point in a MultiPoint #184

Open michaelkirk opened 6 months ago

michaelkirk commented 6 months ago

Extracted from https://github.com/georust/geozero/pull/183

When processing MultiPoints, many of the formats that implement GeometryProcessor do not call point_begin/point_end for each point in a multipoint, and instead call only xy. To be consistent with MultiLineString and MultiPolygon, we should surround each child geometry with it's corresponding begin/ends.

In truth, I don't know of a format yet that requires these events, so I expect most implementations will be a no-op, but I think making the usage consistent across Multi{Point,LineString,Polygon} makes things easier to understand.

processor.begin_multipoint(...)
for point in multipoint {
+  processor.begin_point(...)
   processor.xy(...)
+  processor.end_point(...)
}
processor.end_multipoint(...)
kylebarron commented 6 months ago

I don't think this is possible without a breaking change because point_begin does not have a tagged argument.