当前位置:网站首页>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") #将图层掺入到数据框中
>>>
【结果展示】:
边栏推荐
- May product upgrade observation station
- First pass! Baidu AI Cloud Xiling platform has obtained the authoritative certification of digital human ability evaluation from the Institute of information technology
- B - Bridging signals
- Machine learning notes - seasonality of time series
- 黑马笔记---常用API
- P2393 yyy loves Maths II
- Electron official docs series: References
- 倍福PLC旋切基本原理和应用例程
- 倍福NC轴状态转移图解析
- Processsing function random
猜你喜欢

How does easygbs solve the abnormal use of intercom function?

The El form item contains two inputs. Verify the two inputs

System tasks (display / print class) in Verilog - $display, $write, $strobe, $monitor

倍福PLC通过MC_ReadParameter读取NC轴的配置参数

Stream learning record

【网络是怎么连接的】第一章:浏览器生成消息

【网络是怎么连接的】第二章(下):一个网络包的接收

Deeply analyze the differences between dangbei box B3, Tencent Aurora 5S and Xiaomi box 4S

National standard gb28181 protocol easygbs video platform TCP active mode streaming exception repair

Processsing mouse interactive learning
随机推荐
自动化测试的局限性你知道吗?
Solution of Splunk iowait alarm
5月产品升级观察站
原型模式(prototype)
First knowledge - Software Testing
软件测试测试常见分类有哪些?
Explain C language 11 in detail (C language series)
P5733 [deep foundation 6. example 1] automatic correction
postgis计算角度
倍福PLC通过程序获取系统时间、本地时间、当前时区以及系统时间时区转换
Dark horse notes - Common APIs
Fire warning is completed within 10 seconds, and Baidu AI Cloud helps Kunming Guandu build a new benchmark of smart city
HDU 3555 Bomb
tauri vs electron
Is it safe for the head teacher to open a stock account and open an account for financial management?
Source code learning: atomicinteger class code internal logic
Goto statement to realize shutdown applet
C# const详解:C#常量的定义和使用
OPLG: 新一代云原生可观测最佳实践
mariadb学习笔记