rrjs69

Generate Euclidian distance

Discussion created by rrjs69 on Mar 26, 2012
Latest reply on Mar 26, 2012 by rrjs69
Hi
Please help me I am a novice in python.
Please help to generate straight line distances for the point shapefiles.
I am able to load the point shapefile using the following script.
It should read the filed 'name' from the points.shp and save it to the output folder.
Thank you very much for helping me.


Code to load the points.shp in the mxd:

# Import system modules
import arcpy, sys, string, os, arcgisscripting

# Create the Geoprocessor object
gp = arcgisscripting.create()

# Set the input workspace
gp.workspace = r"C:\Research-gravity\Huff\Santhi\SGravity/gravity.mdb"

# Set the output workspace
out_workspace = r"C:\Research-gravity\Huff\Santhi\SGravity/gravity.mdb"

# get the map document
mxd = arcpy.mapping.MapDocument(r"C:\Research-gravity\Huff\Santhi\SGravity\StLine.mxd")

# Set the workspace
arcpy.env.workspace = r"C:\Research-gravity\Huff\Santhi\SGravity"

# Check out any necessary licenses
gp.CheckOutExtension("spatial")

# get the data frame
df = arcpy.mapping.ListDataFrames(mxd,"*")[0]

# create a new layer
newlayer = arcpy.mapping.Layer(r"C:\Research-gravity\Huff\Santhi\SGravity\points.shp")

# add the layer to the map at the bottom of the TOC in data frame 0
arcpy.mapping.AddLayer(df, newlayer,"AUTO_ARRANGE")

# save the mxd file
mxd.save()
# overwrite outputs
gp.overwriteoutput = 1

del mxd

Outcomes