arcgis

arcgis python 获得打印机

这一生的挚爱 提交于 2019-11-27 16:47:11
class ToolValidator: """Class for validating a tool's parameter values and controlling the behavior of the tool's dialog.""" def __init__(self): """Setup the Geoprocessor and the list of tool parameters.""" import arcgisscripting as ARC self.GP = ARC.create(9.3) self.params = self.GP.getparameterinfo() def initializeParameters(self): """Refine the properties of a tool's parameters. This method is called when the tool is opened.""" import arcpy.mapping as MAP printerList = MAP.ListPrinterNames() if not self.params[1].Altered: self.params[1].Filter.List = printerList return def updateParameters

arcgis python 布局中所有元素信息报告

谁说我不能喝 提交于 2019-11-27 16:46:00
# Author: ESRI # Date: July 5, 2010 # Version: ArcGIS 10.0 # Purpose: This script generates a report of each page layout element and its # associated properties. This script is intended to run as a scrip tool # and requires two parameters: # 1) Input map document, # 2) Output text file. import arcpy, os, datetime #Read parameters from tool mxdPath = arcpy.GetParameterAsText(0) output = arcpy.GetParameterAsText(1) try: #Create r/w output file outFile = open(output, "w") #Generate Report header outFile.write("PageLayout Element Report: \n") outFile.write("\n") outFile.write("This report lists

arcgis python 布局视图中文本查找替换

ε祈祈猫儿з 提交于 2019-11-27 16:45:41
# 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

arcgis python 布局中所有元素平移

天涯浪子 提交于 2019-11-27 16:45:17
# Author: ESRI # Date: July 5, 2010 # Version: ArcGIS 10.0 # Purpose: This script will loop through every page layout element and apply the # specified X and Y shifts to each element. The script is helpful for # repositioning the elements so they are better aligned with the printer # margins/page. This script is intended to run as a script tool and # has four parameters: # 1) Input map document, # 2) X shift, # 3) Y shift, # 4) Output map document. import arcpy, os import arcpy.mapping as MAP #Read parameters from dialog mxdPath = arcpy.GetParameterAsText(0) xShift = arcpy.GetParameterAsText(1

ArcGIS——图层与数据

江枫思渺然 提交于 2019-11-27 14:03:28
该文章翻译至ArcGIS官网教程 Layers and data ,采用了Google翻译辅助,对不恰当的名称和语句做了修改。有能力的建议直接阅读英文原版。 1. 介绍 图层是可以在 Map 对象中使用的数据集合。可以在客户端上创建图层数据,由ArcGIS Online和ArcGIS Enterprise托管,或由外部服务器托管。 2. 数据——要素的集合 图层通常用于管理和显示大量 要素 。要素是地理位置或实体的记录。每个要素都包含为几何图形(点,折线或多边形)定义的 空间坐标 和存储其他信息的 属性字段 。这些要素集可以被认为是: 结构化 :如果每个要素具有相同的几何图形和相同属性的关键字 非结构化 :如果任何要素具有不同几何图形或不同属性的关键字 注意: 有时会说要素有模式,而几何图形没有模式。 使用一组要素时,一般的经验法则是: 如果是 结构化 用于 FeatureLayer 显示数据 如果 非结构化 用于 GraphicsLayer 显示数据 3. 核心图层的类型 ArcGIS JS API具有许多可用于访问和显示图层数据的图层类。所有类都继承自 Layer 。使用哪个类取决于数据的格式和数据的存储位置。不同的图层类型显示出不同的功能。 下面是最常见的图层类的列表。 Class Data Storage Capabilities FeatureLayer

arcgis python 参数验证

蹲街弑〆低调 提交于 2019-11-27 13:18:05
import arcpy class ToolValidator(object): """Class for validating a tool's parameter values and controlling the behavior of the tool's dialog.""" def __init__(self): """Setup arcpy and the list of tool parameters.""" self.params = arcpy.GetParameterInfo() def initializeParameters(self): """Refine the properties of a tool's parameters. This method is called when the tool is opened.""" return def updateParameters(self): """Modify the values and properties of parameters before internal validation is performed. This method is called whenever a parameter has been changed.""" if self.params[0].value

arcgis python pdf合并

一世执手 提交于 2019-11-27 12:19:24
# -*- coding: cp936 -*- import arcpy, os, string #Read input parameters from script tool PDFList = string.split(arcpy.GetParameterAsText(0), ";") outPDFpath = arcpy.GetParameterAsText(1) #Create a new PDF object to store the results outputPDF = arcpy.mapping.PDFDocumentCreate(outPDFpath) #Loop through and append each PDF in the list for eachPDF in PDFList: arcpy.AddMessage(u"合并"+str(eachPDF)) outputPDF.appendPages(str(eachPDF)) #Save the changes and open the result automatically outputPDF.saveAndClose() os.startfile(outPDFpath) #Remove variable reference to file del outputPDF 来源: https://www

arcgis python 随机取部分数据

三世轮回 提交于 2019-11-27 11:10:29
# -*- coding: cp936 -*- import arcpy import os import ylpy import random def main(): num=ylpy.getCount(inFeature) n=int(num*mscale/100) ylpy.clearselect(inFeature) A=random.sample(range(num),n) FID=ylpy.getOIDField(inFeature) sql=str(FID)+" in (" for i in range(0,n): sql=sql+str(A[i]) if i<n-1: sql=sql+"," sql=sql+")" arcpy.Select_analysis(inFeature,outFeature,sql) inFeature = arcpy.GetParameterAsText(0) # mscale = arcpy.GetParameter(1) # outFeature = arcpy.GetParameterAsText(2) # try: main() #arcpy.SetParameterAsText(3, inFeature) # Is polygon except Exception, ErrorDesc: arcpy.AddError(u

arcgis python 删除一个数据库所有数据

可紊 提交于 2019-11-27 11:05:28
# -*- coding: cp936 -*- import xlrd # must init xlrd import arcpy import os def main(): arcpy.env.workspace =gdbFile datasets = arcpy.ListDatasets() for dataset in datasets: arcpy.AddMessage(u"gisoracle删除数据集"+dataset) arcpy.Delete_management(dataset,"FeatureDataset") featureclasses = arcpy.ListFeatureClasses() for fc in featureclasses: arcpy.AddMessage(u"gisoracle删除要素类"+fc) arcpy.Delete_management(fc) tables = arcpy.ListTables() for table in tables: arcpy.AddMessage(u"gisoracle删除表格"+table) arcpy.Delete_management(table) rasters = arcpy.ListRasters() for raster in rasters: arcpy.AddMessage(u

jqgrid json reader for arcgis server query results

穿精又带淫゛_ 提交于 2019-11-27 09:52:20
what kind of json reader I need to plot data like these in a jqgrid? Thanks! You have strange questions and all about the jsonReader . In the current case you can use jsonReader: { root: 'features', repeatitems: false } to read the data. The demo shows how the results can looks like: UPDATED : How I understand, what you want really to do is to call some external URL which provide you back the JSON. Standard Ajax request can't be done to another server because of security reasons (see same origin policy ). Fortunately the server sampleserver1.arcgisonline.com/ArcGIS supports JSONP requests. So