I have to mention that I am running your script using ipython notebook, apparently it gives better exception information.
Here is the notebook with the full exception. http://nbviewer.ipython.org/urls/raw.githubusercontent.com/guziy/PyNotebooks/master/shapely_test.ipynb?create=1 Cheers 2014-04-28 15:31 GMT-04:00 Oleksandr Huziy <guziy.sa...@gmail.com>: > I am using Python 2.7.6 and shapely 1.3.1. > > What I also noticed that if you increase the distance to 10000 the error > also disappears... > > Cheers > > > 2014-04-28 15:24 GMT-04:00 Alex Flint <alex.fl...@gmail.com>: > > Sorry, python 2.7.6. >> >> >> On Mon, Apr 28, 2014 at 3:23 PM, Alex Flint <alex.fl...@gmail.com> wrote: >> >>> Hmm that's strange, I haven't seen that error. What version of shapely >>> are you using (I'm using 1.3.0). Also I'm on python 1.7.6. >>> >>> Attaching the exact python script that I am running at my end. >>> >>> I have also found that if I add small random numbers to each element of >>> the data array (gaussian random numbers of order 1e-2) then I do not get >>> the crash (and in fact I get the correct result), which suggests to me that >>> this is some instability/round-off issue. >>> >>> Alex >>> >>> >>> >>> On Mon, Apr 28, 2014 at 3:12 PM, Oleksandr Huziy >>> <guziy.sa...@gmail.com>wrote: >>> >>>> I get this error message when executing your code: >>>> >>>> ERROR:shapely.geos:TopologyException: depth mismatch at at >>>> 581037.39250326285 4509301.9737485535 >>>> >>>> >>>> Have no idea what this means, but maybe you know)) >>>> >>>> Cheers >>>> >>>> >>>> 2014-04-28 14:55 GMT-04:00 Alex Flint <alex.fl...@gmail.com>: >>>> >>>>> 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 >>>>> >>>>> >>>>> _______________________________________________ >>>>> Community mailing list >>>>> Community@lists.gispython.org >>>>> http://lists.gispython.org/mailman/listinfo/community >>>>> >>>>> >>>> >>>> >>>> -- >>>> Sasha >>>> >>>> _______________________________________________ >>>> Community mailing list >>>> Community@lists.gispython.org >>>> http://lists.gispython.org/mailman/listinfo/community >>>> >>>> >>> >> >> _______________________________________________ >> Community mailing list >> Community@lists.gispython.org >> http://lists.gispython.org/mailman/listinfo/community >> >> > > > -- > Sasha > -- Sasha
_______________________________________________ Community mailing list Community@lists.gispython.org http://lists.gispython.org/mailman/listinfo/community