-1

This question already has an answer here:

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.

marked as duplicate by PolyGeo Mar 27 at 19:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    do you have access to geopandas? – Paul H Mar 27 at 18:37
  • what format is the data stored in in the first place? how are you updating them? sounds like you could achieve this quickly with geopandas and python but need some more details – saph_top Mar 27 at 18:56
-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')
)
  • I don't have geopandas :( – user139471 Mar 27 at 19:11
  • @user139471 if you have conda installed or can install conda, geopandas is pretty easy to get these days. In either case, I'll leave this answer up for future readers who have similar problems – Paul H Mar 27 at 20:07

Not the answer you're looking for? Browse other questions tagged or ask your own question.