- Programming ArcGIS 10.1 with Python Cookbook
- Eric Pimpler
- 257字
- 2021-07-30 17:29:57
Getting a list of tables
The arcpy.mapping
module also has a ListTableViews()
function that you can use to obtain a list of standalone tables that are contained within a map document. In this recipe, you will learn how to use the ListTableViews()
function to create this list of tables.
Getting ready
In addition to providing the ability to generate a list of layers in a map document or data frame, the arcpy mapping
module also provides a ListTableViews()
function that generates a list of tables.
How to do it…
Follow these steps to learn how to get a list of standalone tables in a map document:
- Open
c:\ArcpyBook\Ch3\Crime_Ch3.mxd
with ArcMap. - Click on the Python window button from the main ArcMap toolbar.
- Import the
arcpy.mapping
module:import arcpy.mapping as mapping
- Reference the currently active document (
Crime_Ch3.mxd
), and assign the reference to a variable:mxd = mapping.MapDocument("CURRENT")
- Generate a list of tables in the map document:
for tableView in mapping.ListTableViews(mxd): print tableView.name
- Run the script to see the following output:.
Crime2009Table
How it works…
The ListTableViews()
function is very similar to the other list functions provided by arcpy.mapping
. As was the case with ListLayers()
, the ListTableViews()
function accepts a reference to a map document (but not a layer file), along with an optional wildcard and data frame parameters. The output is a list of tables that can be iterated with a for
loop.
- 從零構建知識圖譜:技術、方法與案例
- C程序設計簡明教程(第二版)
- 深入淺出Java虛擬機:JVM原理與實戰
- Access 2010數據庫基礎與應用項目式教程(第3版)
- aelf區塊鏈應用架構指南
- STM32F0實戰:基于HAL庫開發
- 小程序,巧運營:微信小程序運營招式大全
- TypeScript項目開發實戰
- Scientific Computing with Scala
- 高級語言程序設計(C語言版):基于計算思維能力培養
- 微服務從小白到專家:Spring Cloud和Kubernetes實戰
- 新一代SDN:VMware NSX 網絡原理與實踐
- Visual Studio Code 權威指南
- .NET 4.5 Parallel Extensions Cookbook
- Java并發編程之美