Hi Ari,

No, you can't delete an item like that (by design), but you can reassign to
a geometry object's coords attribute:

>>> from shapely.geometry import Point
>>> p = Point(0, 0)
>>> list(p.coords)
[(0.0, 0.0)]
>>> p.wkt
'POINT (0 0)'
>>> p.coords = [(1,1)]
>>> list(p.coords)
[(1.0, 1.0)]
>>> p.wkt
'POINT (1 1)'

I hope this helps,



On Mon, Feb 24, 2014 at 11:55 AM, Ari Simmons <ari.ucb.f...@gmail.com>wrote:

> Ran 'print dir(ring)' got:
>
> >>['__array_interface__', '__class__', '__del__', '__delattr__',
> '__dict__', '__doc__', '__format__', '__geo_interface__', '__geom__',
> '__getattribute__', '__hash__', '__init__', '__module__', '__new__',
> '__p__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__',
> '__setstate__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__',
> '_crs', '_ctypes_data', '_geom', '_get_coords', '_get_geom', '_is_empty',
> '_lgeos', '_ndim', '_owned', '_set_coords', '_set_geom', 'almost_equals',
> 'area', 'array_interface', 'array_interface_base', 'boundary', 'bounds',
> 'buffer', 'centroid', 'contains', 'convex_hull', 'coords', 'crosses',
> 'ctypes', 'difference', 'disjoint', 'distance', 'empty', 'envelope',
> 'equals', 'equals_exact', 'geom_type', 'geometryType', 'has_z', 'impl',
> 'interpolate', 'intersection', 'intersects', 'is_ccw', 'is_empty',
> 'is_ring', 'is_simple', 'is_valid', 'length', 'overlaps',
> 'parallel_offset', 'project', 'relate', 'representative_point', 'simplify',
> 'symmetric_difference', 'to_wkb', 'to_wkt', 'touches', 'type', 'union',
> 'within', 'wkb', 'wkt', 'xy']
>
> so, really...I can't delete a coordinate from a LinearRing?
>
>
> On Mon, Feb 24, 2014 at 10:30 AM, Ari Simmons <ari.ucb.f...@gmail.com>wrote:
>
>> I am running into this error:
>>
>> >>TypeError: 'CoordinateSequence' object doesn't support item deletion
>>
>> on trying to delete points from a LinearRing (see sample below).
>>
>> >>         # Remove points indexed in removeList
>>  >>       # Sort the list of indices in reverse order
>> >>      #so that they can be deleted without throwing off other indices
>>
>>
>> >>        for i in sorted(removeList, reverse=True):
>> >>            del(ring.coords[i])
>>
>> ring.coords is the list of coordinates.. just trying to delete...can this
>> not be done on a LinearRing?
>>
>
>
> _______________________________________________
> Community mailing list
> Community@lists.gispython.org
> http://lists.gispython.org/mailman/listinfo/community
>
>


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

Reply via email to