首页 > 其他分享 >[924] ArcGIS Pro Mapping Module - arcpy.mp

[924] ArcGIS Pro Mapping Module - arcpy.mp

时间:2023-10-24 10:12:01浏览次数:32  
标签:map geometry Pro object list Mapping access extent arcpy

ref: Introduction to arcpy.mp

ref: Getting started with arcpy.mp tutorial

ref: Guidelines for arcpy.mp

ref: Alphabetical list of arcpy.mp functions

ref: Alphabetical list of arcpy.mp classes

ref: SQL reference for query expressions used in ArcGIS


The following diagram illustrates the utility of list functions for navigating and referencing the objects within a project or a layer file. The diagram is only an example and does not display a complete set of objects. 

Classes

  • ArcGISProject: The ArcGISProject object provides access to ArcGIS Pro project methods and properties. A reference to this object is essential for most map automation workflows.

    • listMaps ({wildcard}): Returns a Python list of Map objects in an ArcGIS project (.aprx).

    • listLayouts ({wildcard}): Returns a Python list of Layout objects in an ArcGIS project (.aprx).

  • Map: The Map object is the primary object for referencing and managing layers and tables within an ArcGIS Pro project.

    • listLayers ({wildcard}): Returns a Python list of Layer objects that exist within a map.

    • listTables ({wildcard}): Returns a Python list of Table objects that exist within a map.

  • Layer: Provides access to basic layer properties and methods.

    • supports (layer_property): Used to determine if a particular layer type supports a property on the layer object. Not all layers support the same set of properties; the supports property can be used to test if a layer supports that property before attempting to set it. i.e., lyr.supports("BRIGHTNESS") and lyr.supports("NAME").

    • listLayers ({wildcard}): Returns a Python list of Layer objects that exist within a map.

    • listTables ({wildcard}): Returns a Python list of Table objects that exist within a map.

    • getSelectionSet (): Returns a layer's selection as a Python set of object IDs.
  • Table: Provides access to basic table properties and methods.

    • listLayers ({wildcard}): Returns a Python list of Layer objects that exist within a map.

    • listTables ({wildcard}): Returns a Python list of Table objects that exist within a map.

  • Layout: The Layout object references a single-page layout in an ArcGIS Pro project (.aprx). It provides access to common properties like page size and a number of different export methods.

    • listElements ({element_type}, {wildcard}): Returns a Python list of page layout elements that exist on a Layout object. The listElements method provides access to all the elements on the page layout: GraphicElementLegendElementMapFrameElementMapSurroundElementPictureElement, and TextElement.

      lyt.listElements("mapframe_element")
    • exportToPDF (out_pdf, {resolution}, {image_quality}, {compress_vector_graphics}, {image_compression}, {embed_fonts}, {layers_attributes}, {georef_info}, {jpeg_compression_quality}, {clip_to_elements}, {output_as_image}, {embed_color_profile}, {pdf_accessibility}): Exports the Layout to Portable Document Format (PDF).
  • MapFrame: The MapFrame object is a page layout element that is used to display the contents of a map on a layout. It also provides access to page size and positioning, basic navigation methods, and export options.

    • map(Read and Write): The Map being displayed in the map frame.

    • camera(Read and Write): The Camera controls the location and viewing positions of the data being displayed within a map frame.
    • getLayerExtent (layer, {selection_only}, {symbolized_extent}): Returns a layer's extent for all features or only the selected features in a layer.

    • panToExtent (extent): Pans and centers the MapFrame using a new Extent object without changing the map frame's scale. 

    • zoomToAllLayers ({selection_only}, {symbolized_extent}): Modifies the MapFrame view to match the extent of all layers or selected layers in a map.

  • GraphicElement: The GraphicElement object provides access to properties that enables its repositioning on the page layout, as well as methods that allow for duplicating and deleting existing graphic elements.

  • LegendElement: The LegendElement object provides access to properties that enable its positioning and resizing on the page layout as well as modifying its title. It also provides access to individual LegendItems.

  • MapsurroundElement: Provides access to properties that enables its repositioning on the page layout as well as identifying its associated map frame.

  • PictureElement: Provides access to picture properties that enable the repositioning of a picture on the page layout as well as getting and setting its data source.

  • TextElement: The TextElement object provides access to properties that enable its repositioning on the page layout as well as modifying the text string and font size.

  • Camera: The Camera object provides access to 2D and 3D viewer properties that control the display in a MapFrame or MapView.
    • getExtent (): Returns an Extent object for a 2D map frame.
    • setExtent (extent): Sets the Extent for a map frame in a layout.

  • Extent: An extent is a rectangle specified by providing the coordinate of the lower left corner and the coordinate of the upper right corner in map units.

    • XMax(Read Only): The extent XMax value. None if no m-value.

    • XMin(Read Only): The extent XMin value. None if no m-value.

    • YMax(Read Only): The extent YMax value. None if no m-value.

    • YMin(Read Only): The extent YMin value. None if no m-value.

    • contains (second_geometry, {relation}): Indicates if the base geometry contains the comparison geometry. contains is the opposite of within.

    • equals (second_geometry): Indicates if the base and comparison geometries are of the same shape type and define the same set of points in the plane. This is a 2D comparison only; M and Z values are ignored.

  • Geometry: Geometry objects define a spatial location and an associated geometric shape.

    • extent (Read and Write): The extent of the geometry.
    • boundary (): Constructs the boundary of the geometry. (polygon to polyline)

    • buffer (distance): Constructs a polygon at a specified distance from the geometry.

    • clip (envelope): Constructs the intersection of the geometry and the specified extent.

    • cut (cutter): Splits this geometry into a part left of the cutting polyline, and a part right of it.

    • intersect (other, dimension): Constructs a geometry that is the geometric intersection of the two input geometries. Different dimension values can be used to create different shape types. The intersection of two geometries of the same shape type is a geometry containing only the regions of overlap between the original geometries.

    • union (other): Constructs the geometry that is the set-theoretic union of the input geometries. The two geometries being unioned must be the same shape type.

  • SearchCursor: Establishes read-only access to the records of a feature class or table. It returns an iterator of tuples. The order of values in the tuple matches the order of fields specified by the field_names argument.
    Geometry object properties can be accessed by specifying the token SHAPE@ in the list of fields.
    Search cursors can be iterated using a for loop.
    Accessing full geometry with SHAPE@ is an expensive operation. If only simple geometry information is required, such as the x,y coordinates of a point, use tokens such as SHAPE@XY, SHAPE@Z, and SHAPE@M for faster, more efficient access.

    SearchCursor (in_table, field_names, {where_clause}, {spatial_reference}, {explode_to_points}, {sql_clause}, {datum_transformation})
    •  fields (Read Only): A tuple of field names used by the cursor. The tuple will include all fields and tokens specified by the field_names argument.

  • Code sample:

    import arcpy
    
    fc = 'c:/data/base.gdb/well'
    fields = ['WELL_ID', 'WELL_TYPE', 'SHAPE@XY']
    
    # For each row, print the WELL_ID and WELL_TYPE fields, and
    # the feature's x,y coordinates
    with arcpy.da.SearchCursor(fc, fields) as cursor:
        for row in cursor:
            print(u'{0}, {1}, {2}'.format(row[0], row[1], row[2]))
  • SpatialReference: Each part of the spatial reference has a number of properties (especially the coordinate system) that defines what map projection options are used to define horizontal coordinates.
    A SpatialReference object can also be accessed from existing datasets using the Describe spatialReference property.
    SpatialReference ({item}, {vcs}, text)

标签:map,geometry,Pro,object,list,Mapping,access,extent,arcpy
From: https://www.cnblogs.com/alex-bn-lee/p/17784097.html

相关文章

  • CH32X035 模拟IIC驱动EEPROM
    在CH32X035的GPIO模式配置选项中,并没有开漏输出的配置模式,如下图。在使用GPIO模拟IIC时,可在初始化时将其配置成推挽输出模式,在需要时切换对应的输入输出模式,以下是CH32X035GPIO模拟IIC的实现例程。 具体程序代码如下:iic.h文件:#ifndef__IIC_H#define__IIC_H#include"c......
  • CH32X035 模拟IIC驱动EEPROM
    来源:https://www.cnblogs.com/liaigu/p/17784027.html在CH32X035的GPIO模式配置选项中,并没有开漏输出的配置模式,如下图。在使用GPIO模拟IIC时,可在初始化时将其配置成推挽输出模式,在需要时切换对应的输入输出模式,以下是CH32X035GPIO模拟IIC的实现例程。 具体程序代码如下:iic.......
  • java.security.provider.getservice blocked
    bug:https://bugs.openjdk.org/browse/JDK-8206333堆栈:"Osp-Common-Business-Thread-572"Id=1723BLOCKEDatjava.security.Provider.getService(Provider.java:1035)atsun.security.jca.ProviderList.getService(ProviderList.java:332)atsun.security.jca......
  • Proj CDeepFuzz Paper Reading: POLYCRUISE: A Cross-Language Dynamic Information F
    Abstract本文:PolyCruiseMethod:跨编程语言的holisticdynamicinformationflowanalysis(DIFA)usealightlanguage-specificanalysis和language-agnosticonlinedataflowanalysis来计算symbolicdependencies实验:数据集:PolyBench,包含小中大三种等级的benchmarks效......
  • PAT 甲级【1009 Product of Polynomials】
    /*系数为0不输出貌似runtime异常也显示答案不正确*/importjava.io.BufferedReader;importjava.io.IOException;importjava.io.InputStreamReader;importjava.io.StreamTokenizer;publicclassMain{@SuppressWarnings("unchecked")publicstaticvoidmai......
  • Linux /proc和/sys
    在Linux系统中,/proc和/sys都是特殊的文件系统,数据内容是存放在内存中,这两个目录文件中的内容由内核动态生成,查看这个文件中的内容,实际上就是查询内核的某些状态或信息。可以将这两个目录文件理解为虚拟的目录,即在硬盘上不存在。/proc文件系统proc是process(进程)的缩写。这个......
  • Failed to start discovery: org.bluez.Error.InProgress
    #bluetoothctlscanonFailedtostartdiscovery:org.bluez.Error.InProgress问题背景:blueZ版本:#bluetoothd--version5.52kernel版本:4.4.13Bluetoothchipset:RTL8761B(vpid0bda:8771)问题描述:执行scan时报“Failedtostartdiscovery:org.bluez.Error.InPro......
  • properties 文件里,如何打印单引号、双引号
    两个单引号表示一个单引号比如MESSAGE_TICKET_NOT_EXIST=票根''{0}''在不存在双引号,不需要额外处理,直接使用比如screen.confirmation.message=单击<ahref="{0}">这里</a> ......
  • Elasticsearch_exporter + Prometheus + Grafana监控之搭建梳理
    一、安装elasticsearch_exporter并启动1.1官网下载elasticsearch_exporter的安装包,地址如下:如果是Linux系统,建议安装此版本:elasticsearch_exporter-1.3.0.linux-amd64.tar.gzhttps://github.com/prometheus-community/elasticsearch_exporter/releases1.2上传安装包到服务......
  • 【已应用】落地项目中使用的JdbcTemplate-包含application.properties配置 【JdbcTemp
    JdbcTemplatedemo2:是某落地项目中使用的JdbcTemplate。是来检测JdbcTemplate合规性。包含JdbcTemplate封装、sql操作、application.properties数据连接配置等。GitLab项目地址:liuguiqing/JdbcTemplateDemo2·GitLab相关截图:   ......