arcgis python 布局视图中文本查找替换
# Author: ESRI
# Date: July 5, 2010
# Version: ArcGIS 10.0
# Purpose: This script will perform a search and replace on page layout text
# elements. There are options to match case and/or find exact matches.
# This script is intended to run as a scrip tool and requires three
# parameters (and two optional parameters):
# 1) Input map document,
# 2) Find string,
# 3) Replace string,
# 4) Match case,
# 5) Match entire string. import arcpy, string, os #Read input parameters from script tool
mxdPath = arcpy.GetParameterAsText(0)
oldText = arcpy.GetParameterAsText(1)
newText = arcpy.GetParameterAsText(2)
case = arcpy.GetParameter(3)
exact = arcpy.GetParameter(4)
outputMXD = arcpy.GetParameterAsText(5) try:
#Referent the map document
mxd = arcpy.mapping.MapDocument(mxdPath) #Find all page layout text elements
for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT"):
if exact:
if case:
if oldText == elm.text:
elmText = elm.text.replace(oldText, newText)
elm.text = elmText
else:
if oldText.upper() == elm.text.upper():
elmText = elm.text.upper().replace(oldText, newText)
elm.text = elmText
else:
if case:
if oldText in elm.text:
elmText = elm.text.replace(oldText, newText)
elm.text = elmText
else:
if oldText.upper() in elm.text.upper():
elmText = elm.text.upper().replace(oldText, newText)
elm.text = elmText
mxd.saveACopy(outputMXD)
os.startfile(outputMXD) del mxd except Exception, e:
import traceback
map(arcpy.AddError, traceback.format_exc().split("\n"))
arcpy.AddError(str(e))
arcgis python 布局视图中文本查找替换的更多相关文章
- 如何在Vim中的查找替换
“%s/最/第二/g” 用vim的人都知道,这是把所有“最”替换成“第二”的意思.其实vim的查找替换功能非常强大,用的好可以极大提升效率. vim的查找替换命令如下所示: :{作用范围}s/{ ...
- 吴裕雄--天生自然python学习笔记:python文档操作自动查找替换 Word 文件中的指定文字
Win32com 组件提供了自动替换 Word 文件中指定文字 的功能 .在使用“查找” 功能替换文字之前,可先清除源文字及目标文字的格式,以免影响替换效果,语法为 : 替换 Word 文件特定文字的 ...
- arcgis python 布局中所有元素信息报告
# Author: ESRI # Date: July 5, 2010 # Version: ArcGIS 10.0 # Purpose: This script generates a report ...
- arcgis python 布局中所有元素平移
# Author: ESRI # Date: July 5, 2010 # Version: ArcGIS 10.0 # Purpose: This script will loop through ...
- ASP.NET Core 中文文档 第四章 MVC(3.3)布局视图
原文:Layout 作者:Steve Smith 翻译:娄宇(Lyrics) 校对:孟帅洋(书缘) 视图(View)经常共享视觉元素和编程元素.在本篇文章中,你将学习如何在你的 ASP.NET 应用程 ...
- ASP.NET Core Razor 布局视图 - ASP.NET Core 基础教程 - 简单教程,简单编程
原文:ASP.NET Core Razor 布局视图 - ASP.NET Core 基础教程 - 简单教程,简单编程 ASP.NET Core Razor 布局视图 上一章节中我们学习了如何使用 EF ...
- MVC5系列——布局视图
MVC5系列——布局视图 目录 系列文章 概述 布局视图 系列文章 [Asp.net MVC]Asp.net MVC5系列——第一个项目 [Asp.net MVC]Asp.net MVC5系列——添加 ...
- [Asp.net MVC]Asp.net MVC5系列——布局视图
目录 系列文章 概述 布局视图 系列文章 [Asp.net MVC]Asp.net MVC5系列——第一个项目 [Asp.net MVC]Asp.net MVC5系列——添加视图 [Asp.net M ...
- servlet操作本地文件汇总: 判断文件是否存在;文件重命名;文件复制; 获取文件属性信息,转成Json对象; 获取指定类型的文件; 查找替换.txt中的文本
package servlet; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; ...
随机推荐
- Jmeter学习笔记(五)——dubbo接口测试
一.什么是dubbo接口 Dubbo 接口是阿里巴巴开源的致力于提供高性能和透明化的RPC远程服务调用方案,以及SOA服务治理方案,dubbo框架告别了传统的web service的服务模式,进而改用 ...
- 【DRF框架】路由组件
视图组件涉及的路由补充: from rest_framework.viewsets import ViewSetMixin 对路由进行了重新的分发,重写了as_view() 方法,重新封装了请求方法 ...
- apache 防盗链
方法1:Apache防盗链的第一种实现方法,可以用rewrite实现 (1.)首先要确认Apache的rewrite module可用,打开 httpd.conf 文件,如果前面有注释去掉 LoadM ...
- 运输层6——TCP可靠传输的实现
目录 1. 以字节为单位的滑动窗口 2. 超时重传时间的选择 写在前面:本文章是针对<计算机网络第七版>的学习笔记 运输层1--运输层协议概述 运输层2--用户数据报协议UDP 运输层3- ...
- 企业级本地yum源配置方案详解
因目前企业生产网络禁止联网,对于使用Linux的我们来说,非常不方便,想要使用yum源都很困难,挂dvd又不能完全满足要求,所以自建一个企业级的yum源,定时从公网同步到本地,然后生产网络直接配置在本 ...
- Unity Platform Differernces
https://docs.unity3d.com/560/Documentation/Manual/SL-PlatformDifferences.html
- 【bzoj3238】差异 后缀树
题目大意:给你一个字符串$S$,设$S_i$是串$S$第$i$长的后缀,求: $\sum\limits_{i=1}^{|S|} \sum\limits_{j=i+1}^{|S|} |S_i|+|S_j ...
- TDOA基站 之 时间同步
TDOA 和 TWR相比,标签可以用最少的信息来定位,但是对于基站要求很高,需要“时间同步”. 这也是TDOA算法的核心部分,很多套件对此讳莫如深,希望能沟通过本文使读者能对TODA同步有一定初步了解 ...
- 获取登录用户ip
public static String getIpAddr(HttpServletRequest request) { String ipAddress = null; try { ipAddres ...
- bootstrap-wysihtml5 ckeditor 修改富文本编辑器可以上传图片
bootstrap-wysihtml5 ckeditor 修改富文本编辑器可以上传图片 bootstrap-wysihtml5实际使用内核为ckeditor 故这里修改ckeditor即可 ...