The set_coordinates docstring indicates that it "Returns a copy of a geometry array with different coordinates."
However, this doesn't seem to be working correctly:
In [32]: arr
Out[32]:
array([<pygeos.Geometry POINT (1 1)>, <pygeos.Geometry POINT (2 2)>,
<pygeos.Geometry POINT (3 3)>], dtype=object)
In [33]: coords = pygeos.get_coordinates(arr)
In [35]: new_coords = coords * 2
In [36]: arr2 = pygeos.set_coordinates(arr, new_coords)
In [37]: arr2
Out[37]:
array([<pygeos.Geometry POINT (2 2)>, <pygeos.Geometry POINT (4 4)>,
<pygeos.Geometry POINT (6 6)>], dtype=object)
In [39]: arr
Out[39]:
array([<pygeos.Geometry POINT (2 2)>, <pygeos.Geometry POINT (4 4)>,
<pygeos.Geometry POINT (6 6)>], dtype=object)
where the original array was modified in place.
The
set_coordinatesdocstring indicates that it "Returns a copy of a geometry array with different coordinates."However, this doesn't seem to be working correctly:
where the original array was modified in place.