I have python script that creates a point feature class. How do I send that feature to an existing map using Python?
I believe you're looking for arcpy.mapping.AddLayer().
I am using Python script that runs in the background.
# Import arcpy moduleimport arcpy
#Import Time and Dateimport timeimport datetime
#Sets a variable to hold today's date in year month day (yyyymmdd)format to tag feature output name with the current datecurrentdate = datetime.date.today().strftime("%Y""%m""%d")
# Overwrite pre-existing filesarcpy.env.overwriteOutput = True
# Local variables:Changes = "\\\\MyData\\Working_Data.mdb\\Changes"Changes_Layer = "Changes_Layer"Updates = "\\\\MyData\\My_Data.gdb\\Updates\\Updates"+str(currentdate)
# Process: Make XY Event Layerarcpy.MakeXYEventLayer_management(Changes, "longitude", "latitude", Changes_Layer, "", "")
# Process: Feature To Pointarcpy.FeatureToPoint_management(Changes_Layer, Updates, "CENTROID")
Now I would like to add Python script that will take "Updates"+str(currentdate)" and add it to MyDataUpdates.mxd
so I assume you have ArcMap set to add results to display and set visibility on? And I have to ask the obvious...you are running this from within ArcMap? some people have tried to add layers to arcmap without it being open
My script already makes the feature and puts it into a file geodatabase. I would like it to also take that same feature class and drop it into an ArcMap.
do you mean makefeaturelayer ?
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.