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

Weird polygon shape with shapely>=2.0 #430

Closed
colibrisson opened this issue Feb 7, 2023 · 11 comments
Closed

Weird polygon shape with shapely>=2.0 #430

colibrisson opened this issue Feb 7, 2023 · 11 comments

Comments

@colibrisson
Copy link
Contributor

When using lib/segmentation/calculate_polygonal_environment with shapely>=2.0, some of the polygons have a weird shape:

Screenshot from 2023-02-07 11-23-26

As previously reported in #319, there is also a lot of side location conflict exceptions.

Downgrading shapely to 1.7.x solved the issue. Shouldn't shapely be pinned to 1.7?

@mittagessen
Copy link
Owner

mittagessen commented Feb 7, 2023

Which kraken version are you using? master shouldn't even work with pre-2.0 versions anymore because of all the API changes.

The issues in #319 are all resolved in master (or should be at least), I just forgot to close the issue.

@colibrisson
Copy link
Contributor Author

I'm using master.

@mittagessen
Copy link
Owner

Urrrgh. Can you upload the source image and segmentation somewhere so I can look into it? It's probably something in GEOM, like a change in coordinate order returned by some function or something in that order.

@colibrisson colibrisson changed the title Weid polygon shape with shapely>=2.0 Weird polygon shape with shapely>=2.0 Feb 7, 2023
@colibrisson
Copy link
Contributor Author

@mittagessen I just sent you the dataset.

@mittagessen
Copy link
Owner

Can you tell me what exactly you're doing? I don't get any shapely warnings nor do the polygons look weird on current master with shapely 2.0.1 (when repolygonizing with segmentation_overlay.py).

@mittagessen
Copy link
Owner

I had a brain fart and the polygons are indeed broken. But I still don't see any of the warnings. From the looks of it, I assume the region of interest construction is broken somehow. Doing it symbolically with a library like GEOM that changes behavior every second release really screws up things...

@mittagessen
Copy link
Owner

I just pinned shapely to 1.8.4 because I wasn't able to figure out why exactly the ROI is wrong with 2.x. I still don't see any of the warnings and it was the last bit needed for a new release so it will have to do for now.

@bertsky
Copy link

bertsky commented Apr 8, 2024

@mittagessen any news on this in 5.0? I can still see Shapely pinned to pre-2...

@mittagessen
Copy link
Owner

mittagessen commented Apr 8, 2024 via email

@bertsky
Copy link

bertsky commented Apr 9, 2024

Understood.

Note that Shapely 2.0 also makes life somewhat easier with these issues. I started using set_precision to tackle invalid paths after rounding. See here for a complete example. I have also spent a lot of time trying to make polygon handling more robust – let me know if you need help.

@mittagessen
Copy link
Owner

mittagessen commented Apr 9, 2024 via email

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

No branches or pull requests

3 participants