-1

I have updated x,y for about 50,000 points.

How can I move the points to their new location at once (not one by one)?

I know there is a way of creating a new .shp from updated x,y but that won't work since the points are services and part of energized electrical system. I just need to move them to their new location.

PolyGeo
  • 65,136
  • 29
  • 109
  • 338

1 Answers1

-1

If you have python + shapely + geopandas on your system, and the new X-Y values are stored in columns of the attribute table, it'd be as quick as:

from shapely.geometry import Point
import geopandas

# adjust the values as necessary
xcol = 'new_x'
ycol = 'new_y'

(
    geopandas.read_file('path/to/file.shp')
        .assign(geometry=lambda df: df.apply(
            lambda row: Point(row[xcol], row[ycol]),
            axis=1
        )
        .to_file('path/to/shifted.shp')
)
Paul H
  • 915
  • 5
  • 17