error while building multipolygon with shapely 1.5.7
ustroetz opened this issue · 1 comments
ustroetz commented
Problem
I updated shapely 1.5.7
and I get the error below. If I use imposm with shapely 1.5.1
the problem doesn't happen.
It seems like it is related to issue #35.
Command
imposm -d santiago_chile -m imposm-mapping.py --read --write --optimize --overwrite-cache santiago_chile.osm.pbf
Error
Enabling Shapely speedups.
loading imposm-mapping.py as mapping
[18:11:36] ## reading santiago_chile.osm.pbf
[18:11:36] coords: 699k nodes: 13k ways: 99k relations: 0k (estimated)
[18:11:41] coords: 797k nodes: 0k ways: 183k relations: 0k
[18:11:41] reading took 5 s
[18:11:41] ## dropping/creating tables
[18:11:41] ## writing data
[2015-04-23 18:11:41,815] imposm.multipolygon - WARNING - error while building multipolygon:
[2015-04-23 18:11:41,815] imposm.multipolygon - ERROR - Null geometry supports no operations
Traceback (most recent call last):
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/imposm/multipolygon.py", line 146, in build
self.build_relation_geometry(rings)
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/imposm/multipolygon.py", line 221, in build_relation_geometry
rings.sort(key=lambda x: x.geom.area, reverse=True)
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/imposm/multipolygon.py", line 221, in <lambda>
rings.sort(key=lambda x: x.geom.area, reverse=True)
File "/Library/Frameworks/GEOS.framework/Versions/3/Python/2.7/site-packages/shapely/geometry/base.py", line 409, in area
return self.impl['area'](self)
File "/Library/Frameworks/GEOS.framework/Versions/3/Python/2.7/site-packages/shapely/topology.py", line 55, in __call__
self._validate(this)
File "/Library/Frameworks/GEOS.framework/Versions/3/Python/2.7/site-packages/shapely/topology.py", line 18, in _validate
raise ValueError("Null geometry supports no operations")
ValueError: Null geometry supports no operations
Setup
Python 2.7.9 (default, Jan 7 2015, 11:49:12)
imposm 2.6.0 (installed with pip install imposm)
shapely 1.5.7
OS X 10.10.3.
jlnr commented
For anyone finding this on Google—I was running into the same error on OS X 10.10.5, and I've fixed it by deleting everything starting with Shapely from /Library/Python/2.7/site-packages/
, then installing Shapely 1.5.2:
sudo easy_install shapely==1.5.2
I'm not a Pythonist, but I guess you'll have to replace easy_install
with pip
or a venv
incantation depending on your setup :)