Alex Flint
2014-04-28 18:55:30 UTC
The following code produces an exception under shapely (python version)
1.3.0
import shapely.geometry
path = shapely.geometry.LineString([
[581037.19575668662, 4509299.98342364],
[580996.61134201661, 4509304.202782942],
[581037.19575668662, 4509299.98342364],
[581072.19594137045, 4509296.7024005251],
[581072.19594137045, 4509296.7024005251],
[581037.19575668662, 4509299.98342364]
])
path.parallel_offset(2, shapely.geometry.JOIN_STYLE.mitre)
The exception is:
File
"/Users/alexflint/Code/wifi-localization/tools/localization/estimation/scripts/shapely_bug.py",
line 39, in <module>
linestring.parallel_offset(2, shapely.geometry.JOIN_STYLE.mitre)
File
"/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/shapely/geometry/linestring.py",
line 114, in parallel_offset
bool(side == 'left')))
File
"/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/shapely/geometry/base.py",
line 55, in geom_factory
raise ValueError("No Shapely geometry can be created from null value")
ValueError: No Shapely geometry can be created from null value
The points on the path above are actually very close to collinear, but my
understanding was that parallel_offset should work regardless. I have
attached a plot of the path itself.
Any suggestions for what's going on here?
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gispython.org/pipermail/community/attachments/20140428/874e7d72/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: path.pdf
Type: application/pdf
Size: 8176 bytes
Desc: not available
URL: <http://lists.gispython.org/pipermail/community/attachments/20140428/874e7d72/attachment.pdf>
1.3.0
import shapely.geometry
path = shapely.geometry.LineString([
[581037.19575668662, 4509299.98342364],
[580996.61134201661, 4509304.202782942],
[581037.19575668662, 4509299.98342364],
[581072.19594137045, 4509296.7024005251],
[581072.19594137045, 4509296.7024005251],
[581037.19575668662, 4509299.98342364]
])
path.parallel_offset(2, shapely.geometry.JOIN_STYLE.mitre)
The exception is:
File
"/Users/alexflint/Code/wifi-localization/tools/localization/estimation/scripts/shapely_bug.py",
line 39, in <module>
linestring.parallel_offset(2, shapely.geometry.JOIN_STYLE.mitre)
File
"/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/shapely/geometry/linestring.py",
line 114, in parallel_offset
bool(side == 'left')))
File
"/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/shapely/geometry/base.py",
line 55, in geom_factory
raise ValueError("No Shapely geometry can be created from null value")
ValueError: No Shapely geometry can be created from null value
The points on the path above are actually very close to collinear, but my
understanding was that parallel_offset should work regardless. I have
attached a plot of the path itself.
Any suggestions for what's going on here?
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gispython.org/pipermail/community/attachments/20140428/874e7d72/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: path.pdf
Type: application/pdf
Size: 8176 bytes
Desc: not available
URL: <http://lists.gispython.org/pipermail/community/attachments/20140428/874e7d72/attachment.pdf>