AnsweredAssumed Answered

new layer will not display in map

Question asked by andywinngis on Dec 13, 2012
Latest reply on Dec 14, 2012 by andywinngis
I'm sure this very easy but as a progamming nitwit I cannot figure it out. When I run the script in the Python Shell in ArcGIS it runs and displays every layer (I only want to display the output of the intersect operation). When I try running the script from my toolbox it runs successfully but the desired intersect layer isn't added.

My other issue is that everytime I run the script I have to create a new "ProjectLocation_Intersect" layer. I don't want to do that, I just want one layer, how do I tell arcgis that its OK to overwrite that layer?

I'm running ArcGIS 10.1, Python 2.7.

sript follows:

# Import arcpy module import arcpy   # Local variables: mxd= arcpy.mapping.MapDocument(r"R:\lwcd\_land\GIS\SpecialProjects\Cultural_Resource_Map\Cultural_Map_template2.mxd") ProjectLocation = "R:\\lwcd\\_land\\GIS\\SpecialProjects\\Cultural_Resource_Map\\Cultural.gdb\\ProjectArea\\ProjectLocation" gm_seq_shp = "R:\\lwcd\\_land\\GIS\\Data\\Control\\gm_seq.shp" gm_par_shp = "R:\\lwcd\\_land\\GIS\\Data\\Landbase\\gm_par.shp" topbound_shp = "R:\\lwcd\\_land\\GIS\\Data\\USGSBoundaries\\topbound.shp" ProjectLocation_Layer = "ProjectLocation_Layer" topbound_Layer = "topbound_Layer" gm_seq_Layer = "gm_seq_Layer" gm_par_Layer = "gm_par_Layer" ProjectLocation_Intersect4 = "R:\\lwcd\\_land\\GIS\\SpecialProjects\\Cultural_Resource_Map\\Cultural.gdb\\ProjectArea\\ProjectLocation_Intersect4"  # Process: Make Feature Layer arcpy.MakeFeatureLayer_management(ProjectLocation, ProjectLocation_Layer, "", "", "OBJECTID OBJECTID VISIBLE NONE;SHAPE SHAPE VISIBLE NONE;ParcelID ParcelID VISIBLE NONE;ProjectName ProjectName VISIBLE NONE")  # Process: Make Feature Layer (2) arcpy.MakeFeatureLayer_management(topbound_shp, topbound_Layer, "", "", "FID FID VISIBLE NONE;Shape Shape VISIBLE NONE;USGS_QD_ID USGS_QD_ID VISIBLE NONE;QUAD_NAME QUAD_NAME VISIBLE NONE;MAP_EDIT MAP_EDIT VISIBLE NONE;ST_NAME1 ST_NAME1 VISIBLE NONE;ST_NAME2 ST_NAME2 VISIBLE NONE;ST_NAME3 ST_NAME3 VISIBLE NONE;ST_NAME4 ST_NAME4 VISIBLE NONE;DATE_REV DATE_REV VISIBLE NONE;DATE_PUB DATE_PUB VISIBLE NONE;PHOTO_R_DT PHOTO_R_DT VISIBLE NONE")  # Process: Make Feature Layer (3) arcpy.MakeFeatureLayer_management(gm_seq_shp, gm_seq_Layer, "", "", "FID FID VISIBLE NONE;Shape Shape VISIBLE NONE;TAG TAG VISIBLE NONE")  # Process: Make Feature Layer (4) arcpy.MakeFeatureLayer_management(gm_par_shp, gm_par_Layer, "", "", "FID FID VISIBLE NONE;Shape Shape VISIBLE NONE;parno parno VISIBLE NONE;owner1 owner1 VISIBLE NONE;owner2 owner2 VISIBLE NONE;tax_addr tax_addr VISIBLE NONE;tax_add2 tax_add2 VISIBLE NONE;csz csz VISIBLE NONE;revised revised VISIBLE NONE;s_t_r s_t_r VISIBLE NONE;sch_dist sch_dist VISIBLE NONE;assmt_yr assmt_yr VISIBLE NONE;lvalue lvalue VISIBLE NONE;ivalue ivalue VISIBLE NONE;avalue avalue VISIBLE NONE;doc_no doc_no VISIBLE NONE;deed_ac deed_ac VISIBLE NONE;legal1 legal1 VISIBLE NONE;legal2 legal2 VISIBLE NONE;legal3 legal3 VISIBLE NONE;legal4 legal4 VISIBLE NONE;legal5 legal5 VISIBLE NONE;legal6 legal6 VISIBLE NONE;c_sqft c_sqft VISIBLE NONE;c_acres c_acres VISIBLE NONE;prop_csz prop_csz VISIBLE NONE;prop_add prop_add VISIBLE NONE")  # Process: Intersect arcpy.Intersect_analysis("ProjectLocation_Layer #;topbound_Layer #;gm_seq_Layer #;gm_par_Layer #", ProjectLocation_Intersect4, "ALL", "", "INPUT")  # get the data frame df = arcpy.mapping.ListDataFrames(mxd,"Main Map")[0]  # add the layer to the map at the bottom of the TOC in data frame 0 addLayer = arcpy.mapping.Layer("ProjectLocation_Intersect4") arcpy.mapping.AddLayer(df, addLayer,"TOP")