Tell me more ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

enter image description here

i have to snap the point the Layer containing point 'A' the layer of point 'B' , but i have a third layer of vector which is a line layer containing 'line 1', so each vector has a point of layer 'A' as origin of vector, so i like to make snapping in the layers of vectors to point 'B' layer but without changing the angle of the line , like a shift of the whole line not just one point, so the result of the snapping of 'line 1' will be 'line 2'.

i'm working Arcgis engine 10 .NET, i'm open for solutions working just arcgis 10 so i can make the same geoprocessing in arcgis engine.

any suggestion is welcome.

share|improve this question
From your diagram I am not clear exactly how you want to snap, and you don't mention your license level, but if you have ArcEditor or ArcInfo then the Snap tool may be worth looking at: help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//… – PolyGeo Jun 18 '12 at 1:43
i've ArcInfo licence, but the snapping that i'm trying to make, i think couldn't be done using this tool only. – geogeek Jun 18 '12 at 6:41

1 Answer

up vote 1 down vote accepted

i have made an ArcPy code to virtualy snap the lines , so the script calculats the bearing of the lines , snap the origin of the vector, then build new lines from new snapped points using the bearing.

but i have noticed a weird error using the function BearingDistanceToLine_management in arcpy it add an angle of to the bearings , without understanding the cause of the error i have eliminated the difference by 180 - 57.935

import arcpy

#arcpy.AddField_management("directions" , "bearing" , "FLOAT" )

arcpy.CalculateField_management("directions" , "bearing" , "180 - 57.935 + math.atan2(( !Shape.firstpoint.X! - !Shape.lastpoint.X! ),( !Shape.firstpoint.Y! - !Shape.lastpoint.Y! ) ) * (180 / math.pi)" , "PYTHON_9.3")

arcpy.Snap_edit("borne" ,  [["D_GPS", "VERTEX", "5"]] )

arcpy.MakeFeatureLayer_management("borne" , "borne_join")
#arcpy.AddField_management("borne_join" , "X" , "DOUBLE" )
#arcpy.AddField_management("borne_join" , "Y" , "DOUBLE" )

arcpy.CalculateField_management("borne_join" , "X" , "!Shape.lastpoint.X!" , "PYTHON_9.3")
arcpy.CalculateField_management("borne_join" , "Y" , "!Shape.lastpoint.Y!" , "PYTHON_9.3")

#arcpy.AddField_management("borne_join" , "distance" , "SHORT" )
arcpy.CalculateField_management("borne_join" , "distance" , "5" , "PYTHON_9.3")

arcpy.MakeFeatureLayer_management("directions" , "dir_join")

arcpy.AddJoin_management("dir_join" , "borne_id" , "borne_join" , "id" )

arcpy.BearingDistanceToLine_management("dir_join" , "new_dir" , "sde.sde.borne.X" , "sde.sde.borne.Y" , "sde.sde.borne.distance" , "METERS" , "sde.sde.directions.bearing" , "DEGREES"  , "GEODESIC" )

arcpy.Delete_management("borne_join")
arcpy.Delete_management("dir_join")
share|improve this answer
for more detail concerning the errors in this script here is a question for this problem gis.stackexchange.com/q/27736/2969 – geogeek Jun 20 '12 at 21:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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