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

Attachment: path.pdf
Description: Adobe PDF document

_______________________________________________
Community mailing list
Community@lists.gispython.org
http://lists.gispython.org/mailman/listinfo/community

Reply via email to