Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GeometryCollection.to_geo() returns only the last geometry #11

Closed
audunska opened this issue Jun 3, 2021 · 7 comments · Fixed by #23 or flatgeobuf/flatgeobuf#226
Closed

GeometryCollection.to_geo() returns only the last geometry #11

audunska opened this issue Jun 3, 2021 · 7 comments · Fixed by #23 or flatgeobuf/flatgeobuf#226

Comments

@audunska
Copy link

audunska commented Jun 3, 2021

We hit upon this by passing geometries from postgres using geozero: When a GeometryCollection is stored as a postgis Geometry field in the database, and fetched through geozero using the Decode impl, only the last geometry was returned. I'd expect the full collection to be returned instead.

Reproducing repository:
https://github.com/audunska/geozero-bug

@pka
Copy link
Member

pka commented Jun 3, 2021

GeoWriter does not support geometry collections yet. Does your sequence work with wkb.to_json() instead of wkb.to_geo()?

@audunska
Copy link
Author

audunska commented Jun 7, 2021

Thanks for the reply!

GeoWriter does not support geometry collections yet.

In that case it would be nice to have an error instead of just writing wrong data. We spent some time chasing down this. Is this documented anywhere?

Does your sequence work with wkb.to_json() instead of wkb.to_geo()?

That seems to work, yes.

@michaelkirk michaelkirk changed the title Deserializing GeometryCollection from Ewkb returns only the last geometry GeometryCollection.to_geo() returns only the last geometry Mar 30, 2022
@michaelkirk
Copy link
Member

I hit this while working on #19

I updated the title to clarify it's about the target (.to_geo) not the source (WKB or WKT)

@audunska
Copy link
Author

I've been contemplating fixing this a few times. We'd need a stack of geometries in GeoWriter, and it gets into some tricky state machine logic. Is it acceptable to extend the GeoWriter with a stack?

@pka
Copy link
Member

pka commented Mar 31, 2022

I've been contemplating fixing this a few times. We'd need a stack of geometries in GeoWriter, and it gets into some tricky state machine logic. Is it acceptable to extend the GeoWriter with a stack?

A geometry stack is acceptable (and with line_strings we already have kind of a stack).

@michaelkirk
Copy link
Member

Hi @audunska - is this something you're actively working on?

If so, I'm happy to wait a bit longer, otherwise I might take a pass at it.

@audunska
Copy link
Author

Hi @audunska - is this something you're actively working on?

If so, I'm happy to wait a bit longer, otherwise I might take a pass at it.

I am not working on it right now, so please go ahead!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants