当前位置:网站首页>Arcpy——InsertLayer()函数的使用:掺入图层到地图文档里
Arcpy——InsertLayer()函数的使用:掺入图层到地图文档里
2022-06-26 12:40:00 【YuanYWRS】
【声明】:本书代码和数据来源于【基于arcgis的python编程秘笈】。
【思路】:insertlayer()函数可以很准确的将数据添加插入到图层的某个位置中,它需要使用一个参考图层来指定位置,新图层将会添加在指定参考图层的上方或者下方。
【注意】:InsertLayer()函数需要使用参考图层,所有不能对空的数据框使用该函数。
【操作】:

>>> import arcpy.mapping as mapping #用于导入arcpy.mapping模块
>>> mxd=mapping.MapDocument("CURRENT") #引用当前的地图文档,把该引用赋值给变量
>>> df=mapping.ListDataFrames(mxd,"Crime")[0] #获取对Crime(当前文档)数据框的引用。
>>> refLayer=mapping.ListLayers(mxd,"Burglaries*",df)[0] #定义参考图层
>>> insertLayer=mapping.Layer(r"D:\暂时存放\ArcpyBook\data\CityOfSanAntonio.gdb\Crimes2009") #定义相对于参考图层的插入图层
>>> mapping.InsertLayer(df,refLayer,insertLayer,"BEFORE") #将图层掺入到数据框中
>>>
【结果展示】:
边栏推荐
猜你喜欢
![HDU1724[辛普森公式求积分]Ellipse](/img/57/fb5098e150b5f3d91a5d0983a336ee.png)
HDU1724[辛普森公式求积分]Ellipse
What should the software test report include? Interview must ask
![[esp32-c3][rt-thread] run RT-Thread BSP minimum system based on esp32c3](/img/4a/503240b332e3279047c438f1d9845e.png)
[esp32-c3][rt-thread] run RT-Thread BSP minimum system based on esp32c3

四类线性相位 FIR滤波器设计 —— MATLAB源码全集

Detailed explanation of C const: definition and use of C constant

原型模式(prototype)

Deep parsing MySQL binlog

P5733 【深基6.例1】自动修正

mariadb学习笔记

组合模式(Composite )
随机推荐
C# 结构体:定义、示例
Accumulation of interview questions
Learning Processing Zoog
Electron official docs series: Development
UVa11582 [快速幂]Colossal Fibonacci Numbers!
F - Charm Bracelet
mariadb学习笔记
5月产品升级观察站
Copy multiple Excel files and name them different
Stream learning record
首批通过!百度智能云曦灵平台获信通院数字人能力评测权威认证
Processsing 鼠标交互 学习
倍福TwinCAT通过Emergency Scan快速检测物理连接和EtherCAT网络
Sinotech software outsourcing
Processsing mouse interactive learning
Basic principle and application routine of Beifu PLC rotary cutting
倍福PLC实现绝对值编码器原点断电保持---bias的使用
C# const详解:C#常量的定义和使用
PostGIS calculation angle
Power Designer - Custom Comment button