No Shapely geometry can be created from null value
See original GitHub issueExpected behavior and actual behavior.
Expected behaviour: no error Actual behaviour:
TopologyException: assigned depths do not match at 882.50000000000011 1241.5
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-69-fe56313cbba3> in <module>
----> 1 line.parallel_offset(distance=2.5, side='left')
~/anaconda3/lib/python3.6/site-packages/shapely/geometry/linestring.py in parallel_offset(self, distance, side, resolution, join_style, mitre_limit)
144 try:
145 return geom_factory(self.impl['parallel_offset'](
--> 146 self, distance, resolution, join_style, mitre_limit, side))
147 except OSError:
148 raise TopologicalError()
~/anaconda3/lib/python3.6/site-packages/shapely/geometry/base.py in geom_factory(g, parent)
74 # Abstract geometry factory for use with topological methods below
75 if not g:
---> 76 raise ValueError("No Shapely geometry can be created from null value")
77 ob = BaseGeometry()
78 geom_type = geometry_type_name(g)
ValueError: No Shapely geometry can be created from null value
Steps to reproduce the problem.
import shapely
line = shapely.geometry.linestring.LineString([(884.0, 1240.0),(883.0, 1239.0),(882.0, 1239.0),(881.0, 1240.0)])
line.parallel_offset(distance=2.5, side='left')
The weird thing is that the problem does not show if distance=2.499999999999 or distance=2.5000000000001
Operating system
Distributor ID: Ubuntu Description: Ubuntu 16.04.6 LTS Release: 16.04 Codename: xenial
Shapely version and provenance
Shapely==1.6.4.post2 installed from PyPI using pip
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
ValueError: No Shapely geometry can be created from null value
I have validated that my polygons are valid. Initially polyB isn't valid, but it is converted to a valid polygon using buffer(0) ....
Read more >Dissolve causes 'No Shapely geometry can be created from ...
python - Dissolve causes 'No Shapely geometry can be created from null value' in geopandas - Geographic Information Systems Stack Exchange. ...
Read more >GIS: Dissolve causes 'No Shapely geometry can be ... - YouTube
GIS: Dissolve causes ' No Shapely geometry can be created from null value ' in geopandasHelpful? Please support me on Patreon: ...
Read more >ValueError: No Shapely geometry can be created from null value
I have validated that my polygons are valid. Initially polyB isn't valid, but it is converted to a valid polygon using buffer(0) ....
Read more >No Shapely geometry can be created from null value
"ValueError: No Shapely geometry can be created from null value" Script to reproduce the problem : from shapely.wkt import loads from shapely.geometry ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
With latest main branch, we correctly raise the GEOS error instead of the confusing “No Shapely geometry can be created from null value” error:
So I think we label / close this as an upstream GEOS issue?
In addition, with GEOS 3.11, this now works without exception:
GEOS 3.11 will be included in the shapely 2.0 wheels (and with conda you also already use this with shapely 1.8.5).
Closing as fixed upstream in GEOS.