1

I have shapefile river data in line format, import this data with GeoPandas and apply it to a .boundary to get as initial and final coordinates of each line. But as lines intersect a coordinate may appear more than once.

How remove all duplicated coordinates?

The code:

import geopandas as gpd
data=gpd.read_file('/home/user/projetos/data/shapefile/drenagem.shp')
points = data.boundary
points

0      (POINT (333491.5480657421 9655087.635814797), ...
1      (POINT (341810.8488631362 9644289.599092623), ...
2      (POINT (313337.5609903137 9683542.660879284), ...
3      (POINT (338807.641063218 9648943.660769818), P...
4      (POINT (338695.3584550109 9649099.693239413), ...
5      (POINT (338416.3272727653 9651639.210259687), ...
6      (POINT (338365.4593791683 9651724.896800613), ...
7      (POINT (337887.8405421138 9652423.9019504), PO...
8      (POINT (337419.4672116803 9653120.853008965), ...

points[0]

MULTIPOINT (333491.5480657421 9655087.635814797, 337419.4672116803 9653120.853008965)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.