how to import a shape file in the layer using a link?

580
1
10-31-2012 02:17 AM
guidoSCHAEPMAN
New Contributor II
Dear all,

In ArcMap I have got lines. These shape lines, with a field with the 'line number' (1234), are connected points. The unconnected points are in separate shape files on the harddisk. These files are named after the line number (e.g. 1234_points_shp).

Now, I have managed to create a hyperlink using the field calculator, however, then it opens the file in a different software. I would rather have ArcMap open the shape file in the layer in which I am working.

how can this be done? I saw that it is possible to edit the script, but I have no experience with this, so maybe you can help me.

Kind regards,

Guido

NOTE: I do not know whether this is the right topic to ask this question in. If so, my appologies, please send me in the right directoin.
Tags (2)
0 Kudos
1 Reply
guidoSCHAEPMAN
New Contributor II
Dear All,

In the mean time I have had a reply from the ArcGis support (see below). I think it is a nice lead, however, I do not have python   scripting experience. Can you please send me in the right direction?

* Where and how do I specify in which directory the shape files with the points are?
* Where and how do I specify that the filename is the same as the attribute field name 'LINE_NR'?
* Can I use this script in the field calculator?

Kind regards,

Guido

--------------------
Hello Guido,

Unfortunately I could not find a ready-to-use script to accomplish this. Writing code is beyond the scope of technical support.

I found a python script which you can use as an example to load the shapefiles programmatically through to the table of contents:

http://stackoverflow.com/questions/4017896/how-do-i-add-a-shapefile-in-arcgis-via-python-scripting

import arcpy
import arcpy.mapping
# get the map document
mxd = arcpy.mapping.MapDocument("CURRENT") 

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

# create a new layer
newlayer = arcpy.mapping.Layer(theShape) 

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

# Refresh things
arcpy.RefreshActiveView()
arcpy.RefreshTOC()
del mxd, df, newlayer

Maybe this can be a first step towards a solution.
0 Kudos