arcpy.mapping-know Arcpy.mapping
by Li Yuanxiang
ARCMAP provides a powerful map mapping function, in the actual work, as long as it involves the production of thematic maps and Atlas, will inevitably encounter a lot of plot work and map surface element adjustment, this part of the work is simple, but basically tedious repetitive operation, these operations are not only time-consuming, and error-prone, It is often necessary to open the ArcMap interface for multiple operations. For some of the larger data volume map, through the ArcMap interface to adjust one by one, it is easy to adjust the process of the map to bring the card machine or software waiting for a response.
Although visual interaction is a popular foundation, it is obviously not very human when faced with a huge amount of repetitive labor or interface manipulation. Users with a certain ArcGIS base may know to write some code through AO to implement bulk operations. But, after all, the learning cost of AO is relatively high, and it's not easy to write (though it's very powerful). ESRI has specifically introduced the Arcpy.mapping module in the arcgis10.x version to address the workload of Map interaction and batch modification in this case.
Arcpy.mapping is built specifically for professional GIS analysts (and developers). Arcpy.mapping is a coarse-grained object model, or the design principle of a function is that a single arcpy.mapping function can replace multiple lines of ArcObjects code. The advantage of Python is that you don't have to open the ArcMap interface to do the processing. So what are the specific problems that can be solved by arcpy.mapping? ESRI's official help clearly lists the following key scenarios:
- Create a report about the information contained in a map document, such as the data frame coordinate system, layer data source, layer where the data source is damaged, or layout element location.
- Update, repair, or replace a layer data source in a map document or layer file.
- Update the layer symbology without actually opening the map document.
- Finds and replaces text strings for all map documents within a folder.
- Save the map document to a previous version of ArcGIS for distribution.
- Update the map document metadata (for example, keywords, summaries, and descriptions).
- Use the Map Export command to bulk create geographic data, such as a series of GeoTIFF images driven by a list of features in a data frame.
- Automatically create and manage map services to be published through ArcGIS for Server.
- Build multiple PDF Map books:
- Thematic or temporal atlas with title pages, multiple map pages, and any number of additional pages with ancillary content, such as tabular reports and contact lists.
- Reference map book based on data-driven page output.
In fact, the granularity of arcpy.mapping is not so coarse, there are very many fine-grained operations, example layer control, symbol library reading. The benefits are also self-evident. Imagine that there are now 1000 mxd documents that need to change the data source and save it as a previous ArcGIS version of the document, what kind of picture would it be if it were done manually? The arcpy.mapping may have been implemented in just a few more than 10 lines of code.
Of course, arcpy.mapping is not a standalone thing, it needs to use the Python environment, that is to say, the basis of Python is still needed. At the same time, if you want to achieve better results, you have to understand some of the other features of arcpy, arcpy.mapping operations are more auxiliary operations.
arcpy.mapping-know Arcpy.mapping