Movings points in my geometric network to their absolute X,Y obtained through GPS

4794
10
Jump to solution
03-25-2015 12:30 AM
TanmayNaik
New Contributor

hello there, i want to know whether it is possible to move points in my geometric network to their absolute X,Y references using a table with x,y values and a common field, if this is to be done programmatically which script or method will be useful,i dont know much about python scripts or programming would appreciate if i get a ready script which helps me.

0 Kudos
1 Solution

Accepted Solutions
NeilAyres
MVP Alum

Try something like this:

import arcpy
# source & target data location
updateTable = "c:/Data/ESRI-SA/ArcForums/MovingPoints.mdb/tblManholeUpdate"
targetFc = "c:/Data/ESRI-SA/ArcForums/MovingPoints.mdb/TM29_WGS84/Manholes"
# fields to be read
updateFields = ["ManholeID", "X", "Y"]
# fields to be updated
fields = ["ManholeID", "SHAPE@XY"]
# load the update info into a dictionary
# ManholeID should be unique in this data
updateDict = {}
with arcpy.da.SearchCursor(updateTable, updateFields) as Cur:
    for row in Cur:
        updateDict[row[0]] = [row[1], row[2]]
# read the target fc and update
with arcpy.da.UpdateCursor(targetFc, fields) as Cur:
    for row in Cur:
        if row[0] in updateDict:
            xy = updateDict[row[0]]
            x = xy[0]
            y = xy[1]
            row[1] = (x, y)
            Cur.updateRow(row)

View solution in original post

10 Replies
NeilAyres
MVP Alum

This could, of course, be done using python / arcpy. It is a bit difficult to provide a ready made script without some more clues about the actual data. But the general flow might be :

read the ID and NewXY into a python structure like a dictionary.

Open up an Update cursor on the target, read each geometry, look up the new XY and update the existing.

But another, non programmatic approach might be to use a topology between the 2 features. You existing stuff could be snapped automatically to the new points. Be aware that this changes the existing in place, so also make a copy beforehand before doing anything, just in case :

Topology help :

http://resources.arcgis.com/en/help/main/10.2/index.html#//006200000003000000

TanmayNaik
New Contributor

Hi Neil,

Appreciate your response to my query.i work on sewer utility networks. we

have a geometric network built of our data comprising of manholes and sewer

lines , the earlier old data was digitized using filed survey maps based on

geographic locations as reference points such as roads buildings etc but

currently we had undertaken a handheld gps survey for our utility resources

which gave us the correct absolute coordinates based on the readings,now we

wish to move each asset in this case being the manholes to their accurate

locations so as to make the data spatially correct for other stakeholders

to use.The common field of attributes in this case would be the unique

manhole ids assigned so as to correlate which value corresponds to which

manhole.i will be importing and uploading the data as points in a shape

file to my data for reference.So now my aim is to move my existing network

points to their actual locations based on gps survey.

Hope you could suggest how this can be done as the data is voluminous and

doing it manually will be very difficult.

Regards

Tanmay Naik

0 Kudos
MarcelaRondon
Occasional Contributor

i'm sure there has to be a better way using programming or such, but if you have the matching ID's for each manhole in the gps shp, you could create the corresponding fields on said shp and join it (using the ID) to your manhole feature class, transfer the attributes info (field calculator or there might be some transfer tool) and copy/paste de gps points to the feature class (after deleting your original points so there won't be duplicates).

i'm not sure it'll work but that's what i would try if it's only a one time thing, otherwise i would search for a less manually procedure

0 Kudos
NeilAyres
MVP Alum

Try something like this:

import arcpy
# source & target data location
updateTable = "c:/Data/ESRI-SA/ArcForums/MovingPoints.mdb/tblManholeUpdate"
targetFc = "c:/Data/ESRI-SA/ArcForums/MovingPoints.mdb/TM29_WGS84/Manholes"
# fields to be read
updateFields = ["ManholeID", "X", "Y"]
# fields to be updated
fields = ["ManholeID", "SHAPE@XY"]
# load the update info into a dictionary
# ManholeID should be unique in this data
updateDict = {}
with arcpy.da.SearchCursor(updateTable, updateFields) as Cur:
    for row in Cur:
        updateDict[row[0]] = [row[1], row[2]]
# read the target fc and update
with arcpy.da.UpdateCursor(targetFc, fields) as Cur:
    for row in Cur:
        if row[0] in updateDict:
            xy = updateDict[row[0]]
            x = xy[0]
            y = xy[1]
            row[1] = (x, y)
            Cur.updateRow(row)
NeilAyres
MVP Alum

Obviously change the paths and field names to reflect your data.

And make a backup copy of your manholes first

TanmayNaik
New Contributor

Dear Neil,Marcela

Totally appreciate your responses to my query,am sure this will work with my tables too once i change the paths and field names corresponding to my data.

thanks again for the solutions provided.

Regards

Tanmay

0 Kudos
NeilAyres
MVP Alum

If this is the solution to your problem, please mark it as such.

Thanks,

N

AdelaideZumwalt2
New Contributor

I also get this error when I try to run the script in ArcMap:

RuntimeError: The modified geometry must be a different geometry instance from the feature's original geometry (e.g., a copy or new instance). [class name = ServiceLocations, object id = 4]

0 Kudos
NeilAyres
MVP Alum

Without knowing the details it is difficult to say. Type of db?

Are you saying that the points are participating in a network?

You may have to wrap the update cursor loop in an editor session.

0 Kudos