I just installed shapely and basic things seem fine. I started following an example in this tutorial to get a feel for the library.
Specifically:
>>> from shapely.wkt import loads
>>> g = loads('POINT (0.0 0.0)')
>>> g.buffer(1.0).area # 16-gon approx of a unit radius circle
3.1365484905459389
>>> g.buffer(1.0, 128).area # 128-gon approximation
3.1415138011443009
>>> g.buffer(1.0, 3).area # triangle approximation
3.0
>>> list(g.buffer(1.0, cap_style='square').exterior.coords)
[(1.0, 1.0), (1.0, -1.0), (-1.0, -1.0), (-1.0, 1.0), (1.0, 1.0)]
>>> g.buffer(1.0, cap_style='square').area
4.0
When I make the call to g.buffer(1.0, cap_style='square')
, I get the following error:
buf = list(shp.buffer(1.0, cap_style='square'))
File "/usr/lib64/python2.7/site-packages/shapely/geometry/base.py", line 538, in buffer
mitre_limit))
File "/usr/lib64/python2.7/site-packages/shapely/topology.py", line 78, in __call__
return self.fn(this._geom, *args)
ctypes.ArgumentError: argument 5: <type 'exceptions.TypeError'>: wrong type
Reading the documentation here I saw that this example is in the comments in the shapely/geometry/base.py module. However I noticed that the default value for the cap_style argument is of type int (CAP_STYLE.round
) and not string. Not sure if that means anything.
Does anyone have any idea what is going on?