Arc Python to interact with Arc-map
What is ArcPy Mapping and Why is it actually used for :
Arcpy.mapping was built for the professional GIS analyst (as well as for developers). Traditionally, the scenarios listed above had to be done using ArcObjects and it often proved to be a very difficult programming environment to learn for the average GIS professional. Arcpy.mapping is a courser-grained object model, meaning that the functions are designed in a way that a single arcpy.mapping function can replace many lines of ArcObjects code. The following is a very simple example of how arcpy.mapping can be used to reference an existing map document and export it to a PDF document with only two lines of code.
To explore the Overall Arcpy mapping Module use the following PDF:
Arcpy Python Mapping Module
Code for Getting the reference to the MXD :
YourMXD= arcpy.mapping.MapDocument("path to the MXD")
To export the above MXD to PDF using arcpy:
arcpy.mapping.ExportToPdf(YourMXD,"your pdf file")
Pointer to a MXD present on the Disk |
Layout View of the Map Document |
Arcpy.mapping is not a replacement for ArcObjects but rather an alternative for the different scenarios it supports. ArcObjects is still necessary for finer-grain development and application customization, whereas arcpy.mapping is intended for automating the contents of existing map documents and layer files.
No comments:
Post a Comment