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

Seeding with polygon coverages fails due to upgraded Shapely #63

Open
jipeream opened this issue Oct 21, 2023 · 4 comments
Open

Seeding with polygon coverages fails due to upgraded Shapely #63

jipeream opened this issue Oct 21, 2023 · 4 comments

Comments

@jipeream
Copy link

What is the bug or the crash?

Mapproxy uses GDAL/Shapely to deal with coverages when seeding, but fails with Shapely>=2.0 (and I believe >=1.8) as Multipolygons are now iterated in a different way in this library:

File "/usr/local/lib/python3.11/site-packages/mapproxy/util/geom.py", line 237, in transform_multipolygon
for polygon in multipolygon:
TypeError: 'MultiPolygon' object is not iterable

There is already an open issue/PR in Mapproxy:
mapproxy/mapproxy#611
https://github.com/mapproxy/mapproxy/pull/749/files

In the meantime, forcing pip install Shapely==1.7.1 should work (in fact it does).

As an alternative, we can wait until Mapproxy corrects this issue...

Steps to reproduce the issue

Any mapproxy-seed using wkt polygon coverages will fail with the following error:

  File "/usr/local/lib/python3.11/site-packages/mapproxy/util/geom.py", line 222, in transform_geometry
    result = transform_multipolygon(transf, geometry)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/mapproxy/util/geom.py", line 237, in transform_multipolygon
    for polygon in multipolygon:
TypeError: 'MultiPolygon' object is not iterable

Versions

MapProxy 1.16.0
Shapely 2.0

Additional context

No response

@NyakudyaA
Copy link
Collaborator

NyakudyaA commented Oct 21, 2023

@jipeream Thanks, Can you raise a PR here and make sure to add a TODO in the code with a link to the upstream issue so that we can revert the temporary fix when it's fixed upstream,
Alternatively, we can try to release v2.0

@jipeream
Copy link
Author

jipeream commented Oct 21, 2023 via email

@jipeream
Copy link
Author

Two questions:

  1. Do you prefer
    ARG SHAPELY_VERSION='==1.7.1'
    or
    ARG SHAPELY_VERSION='' and a note to use '--build-arg SHAPELY_VERSION="==1.7.1"' ?

  2. Which branch should I ask my PR to be merged in?

@NyakudyaA
Copy link
Collaborator

Maybe we can rather add those installed packages in https://github.com/kartoza/docker-mapproxy/blob/master/Dockerfile#L26 to a requirements file and just install them with pip3 install requirements.txt the new could just add into the readme a comment mentioning that you can specify pinned versions in requirements.txt
do the PR against master

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

2 participants