I have a layer Test generated by arcpy.MakeFeatureLayer_management and Dissolved by arcpy.Dissolve_management ..
I know that this layer is in .gdb data source..
How can i add this layer to my .MXD and save that .MXD using PYTHON?
You need to create a Layer Object from your feature class then add that layer to your mxd.
Adding shapefile as layer in ArcGIS Desktop using Python/ArcPy? - Geographic Information Systems Stack Exchange
This might help: ArcGIS Desktop
and look at the save method here: ArcGIS Help 10.1
ok I got how to save MXD , and add Layer in MXD...
But that layer is exist on disk with .lyr extension ..
My layer data is in .gdb datasource.... how to add layer from .gdb source to MXD?Am i Getting it right?
Hi Waqar, you just need to make a feature layer first, then add the layer the way Tim describes:
<SPAN class="pln">C </SPAN><SPAN class="pun">=</SPAN><SPAN class="pln"> r</SPAN><SPAN class="str">"C:\...\featureclass"</SPAN><SPAN class="pln"><BR />arcpy</SPAN><SPAN class="pun">.</SPAN><SPAN class="typ">MakeFeatureLayer_management</SPAN><SPAN class="pun">(</SPAN><SPAN class="pln">FC</SPAN><SPAN class="pun">,</SPAN><SPAN class="pln"> </SPAN><SPAN class="str">"nameoffeatureclass"</SPAN><SPAN class="pun">)</SPAN>
Sir I am making Feature layer first.
arcpy.MakeFeatureLayer_management creates datasource of the layer in .gdb
how to add that datasouce in MXD?
Thanks all of you for your help...........
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.