The best way to remove coordinates from a coordinate sequence is to
extract the coordinates as a regular Python list, then use the
built-in list methods to delete/modify the list of coordinates, and
then generate a new Shapely geometry. e.g.

from shapely.geometry import LinearRing
from shapely.wkt import loads
lr = loads('LINEARRING (0 0, 0 1, 1 1, 1 0, 0 0)')
lrc = lr.coords[:]  # extract coordinates
del lrc[2]  # delete the third coordinate
lr2 = LinearRing(lrc)  # make a new geometry
lr2.wkt  # 'LINEARRING (0 0, 0 1, 1 0, 0 0)'

-Mike

On 25 February 2014 07:30, 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
>
_______________________________________________
Community mailing list
Community@lists.gispython.org
http://lists.gispython.org/mailman/listinfo/community

Reply via email to