cnmetlab / cnmaps

这是一个可以让中国地图画起来更丝滑的python扩展包
https://cnmaps.rtfd.io
BSD 3-Clause "New" or "Revised" License
113 stars 23 forks source link

对 shapely >= 2.0.* 版本的支持 #106

Open Clarmy opened 1 year ago

Clarmy commented 1 year ago

目前对地图多边形对象是直接继承 shapely.geometry.MultiPolygon 对象。而在 shapely >= 2.0.* 版本以后不再支持这种继承,目前的解决方法是在构建的时候限制 shapely 的版本号必须低于2.0,但是长期这样会导致未来在其他依赖不断迭代的的过程中,如果出现不支持 shapely < 2.0 的依赖限制时,则 cnmaps 可能会难以迭代。因此需要尽快重构部分代码以适配 shapely 2.0 及以上版本的兼容。

huddao commented 8 months ago

请问使用maskout的时候报错AttributeError: 'MultiPolygon' object has no attribute 'maskout'也是这个原因吗,shapely的版本是2.0.2

Clarmy commented 4 months ago

请问使用maskout的时候报错AttributeError: 'MultiPolygon' object has no attribute 'maskout'也是这个原因吗,shapely的版本是2.0.2

是的。

Clarmy commented 4 months ago

对于 shapely>=2.0 无法继承子类的一个解决方案参考:https://github.com/shapely/shapely/issues/1233#issuecomment-977837620

huddao commented 3 weeks ago

请问近期还有支持shapely >= 2.0.* 版本的更新计划吗?

Clarmy commented 3 weeks ago

@huddao 我之前尝试过做兼容,但是目前核心还没解决。如果要强行兼容,有可能需要整体重构很多方法,有些方法可能就用不了了(比如加减合并的功能)。