当前位置:网站首页>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") #将图层掺入到数据框中
>>>
【结果展示】:
边栏推荐
- Typescript
- Machine learning notes - seasonality of time series
- IDC report: the AI cloud market share of Baidu AI Cloud ranks first for six consecutive times
- 数字信号处理——线性相位型(Ⅰ、Ⅲ型)FIR滤波器设计(1)
- Record a phpcms9.6.3 vulnerability to use the getshell to the intranet domain control
- Basic principle and application routine of Beifu PLC rotary cutting
- 原型模式(prototype)
- Go structure method
- POJ 3070 Fibonacci
- Processing polyhedron change
猜你喜欢

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

自动化测试的局限性你知道吗?

倍福PLC基于NT_Shutdown实现控制器自动关机重启

倍福TwinCAT通过Emergency Scan快速检测物理连接和EtherCAT网络

Openlayers drawing dynamic migration lines and curves

Electron official docs series: Processes in Electron

P2393 yyy loves Maths II

Processsing mouse interactive learning

Deep parsing MySQL binlog

第01章_Linux下MySQL的安装与使用
随机推荐
中国剩余定理模板题 互质与非互质
详细讲解C语言10(C语言系列)
UVA5009 Error Curves三分
Solution of Splunk iowait alarm
[esp32-c3][rt-thread] run RT-Thread BSP minimum system based on esp32c3
Lightflow completed the compatibility certification with "daocloud Enterprise Cloud native application cloud platform"
单例的常用创建和使用方式
POJ 3070 Fibonacci
Vivado 错误代码 [DRC PDCN-2721] 解决
软件测试报告应该包含的内容?面试必问
Learning Processing Zoog
详细讲解C语言11(C语言系列)
D - skiing
Software testing - concept
IDC report: the AI cloud market share of Baidu AI Cloud ranks first for six consecutive times
倍福TwinCAT3 NCI在NC轴界面中的基本配置和测试
数字信号处理——线性相位型(Ⅰ、Ⅲ型)FIR滤波器设计(1)
IDC报告:百度智能云AI Cloud市场份额连续六次第一
Processsing mouse interactive learning
10秒内完成火灾预警,百度智能云助力昆明官渡打造智慧城市新标杆