arcgis python获得字段唯一值

# Import native arcgisscripting module
import arcgisscripting, sys
# Create the geoprocessor object
gp = arcgisscripting.create(9.3)

# Table and field name inputs
inTable = sys.argv[1]
inField = sys.argv[2]

rows = gp.SearchCursor(inTable)
row = rows.Next()
# Create an empty list
uniqueList = []
while row:
    # If the value is not already in the list, append it
    if row.GetValue(inField) not in uniqueList:
        uniqueList.append(row.GetValue(inField))
    row = rows.Next()
# Sort the list alphanumerically    
uniqueList.sort()
print uniqueList

========================================

# -*- coding: cp936 -*-
import arcpy import os
import sys
inTable = arcpy.GetParameterAsText(0)
inField = arcpy.GetParameterAsText(1) rows = arcpy.SearchCursor(inTable) # Create an empty list gisoracle
uniqueList = []
for row in rows: # If the value is not already in the list, append it
if row.getValue(inField) not in uniqueList:
uniqueList.append(row.getValue(inField)) # Sort the list alphanumerically
#uniqueList.sort()
arcpy.AddMessage("个数: " + str(len(uniqueList)))
# -*- coding: cp936 -*-
import arcpy import os
import sys
def getuniqueValue(inTable,inField):
rows = arcpy.SearchCursor(inTable)
# Create an empty list
uniqueList = []
for row in rows:
# If the value is not already in the list, append it by gisoracle
if row.getValue(inField) not in uniqueList:
uniqueList.append(row.getValue(inField))
return uniqueList inTable = arcpy.GetParameterAsText(0)
inField = arcpy.GetParameterAsText(1)
uniqueList=getuniqueValue(inTable,inField) arcpy.AddMessage("个数: " + str(len(uniqueList)))

  

 
分类: Python

arcgis python获得字段唯一值的更多相关文章

  1. 获取字段唯一值工具- -ArcPy和Python案例学习笔记

    获取字段唯一值工具- -ArcPy和Python案例学习笔记   目的:获取某一字段的唯一值,可以作为工具使用,也可以作为函数调用 联系方式:谢老师,135-4855-4328,xiexiaokui# ...

  2. ArcGis 获取数据表中某字段唯一值

    from:http://www.cnblogs.com/3echo/archive/2006/08/16/478094.html 1 /// <summary>               ...

  3. Laravel-admin 表单提交同时验证俩个以上的字段唯一值

    $name = isset(request()->all()['name']) ? request()->all()['name'] : ''; $id = isset(request() ...

  4. ArcGIS Python人门到精通目录基于ArcGIS10.2,100以上案例15章42个视频806分钟,51GIS网站上线

    ArcGIS Python人门到精通目录 闫老师 QQ:276529800 微信13108507190 1.  ArcGIS Python基础 1.1  ArcGIS为什么学习Python 1.2 A ...

  5. arcgis python 获得表字段的唯一值

    #获得唯一值 by gisoracle def getuniqueValue(inTable,inField): rows = arcpy.da.SearchCursor(inTable,[inFie ...

  6. ArcGis Python脚本——批量添加字段

    先看如何增加一个字段 函数:arcpy.AddField_management 语法:AddFields_management (in_table, field_description) 参数 说明 ...

  7. ArcGIS自定义工具箱-字段值部分替换

    ArcGIS自定义工具箱-字段值部分替换 联系方式:谢老师,135-4855-4328,xiexiaokui#qq.com 目的:替换某个字段中的字符串 用例:湖南省长沙市=>湖南/长沙:临湘县 ...

  8. ArcGIS api for javascript——渲染-使用唯一值渲染

    描述 本例使用唯一值渲染器来作为美国的符号.每个州有一个字符串属性"SUB_REGION"表示它的国家的地区.UniqueValueRenderer.addValue()方法被用来 ...

  9. AE唯一值符号化的流程以及过程

    唯一值符号化的流程以及过程(转)   一.获取ServerStyle库中的符号       Style符号库在ArcGIS Engine开发中对应的是ServerStyle符号库,可以通过专门的转换程 ...

随机推荐

  1. Spring之XML解析

    XML解析,我们可以通过我们常用的以下代码作为入口 也许,我们习惯使用第一种加载方式,但是以前也存在 第二种加载,并且这两种加载也有差别,下面再来分析. 先分析 第二种 使用 BeanFactory ...

  2. GOLANG多态的特征是通过接口来实现的 GOLANG多态形式之一:多态参数

    GOLANG多态的简单实现 //多态的特征是通过接口来实现的 //多态形式之一:多态参数 package main import( "fmt" _"sort" ...

  3. 通过轻量级终端工具Tera Term远程向linux操作系统上传war文件

    通过轻量级终端工具Tera Term远程向linux操作系统上传war文件 1.打开Tera Term终端工具,并输入正确的远程机器的IP地址以及端口号: 2.输入正确的用户名和密码进入到linux操 ...

  4. ThreadPoolExecutor源码分析二

      接上文,这里继续分析源码 private static final int COUNT_BITS = Integer.SIZE - 3; private static final int CAPA ...

  5. Vue项目中的文件导出

    项目中涉及到文件导出,分xml和excel导出.不同的文件导出格式不同,需要根据文件类型判断导出格式. exportAllData(val){ //全部导出 if(!val){ this.export ...

  6. [zhuanzai]Bean对象注入失败 .NoSuchBeanDefinitionException: No qualifying bean of type..

    nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying b ...

  7. Path variable [contentHash:8] not implemented in this context: styles.[contentHash:8].css

    webPack 升级到 4.3.0 导致 extract-text-webpack-plugin 无法使用  

  8. P4074 [WC2013]糖果公园

    思路 带修莫队+树上莫队 注意代码细节即可,答案的维护非常简单 蒟蒻的大常数代码 #include <cstdio> #include <algorithm> #include ...

  9. [唐胡璐]Selenium技巧- 抓图并保存到TestNG报告中

    这里不讲解怎么在Eclipse安装配置TestNG,网上一搜一大把,大家自己去实践一下。 在这里主要说一下用Java来实现Selenium Webdriver的截图功能和把截图写到TestNG的报告中 ...

  10. zxy

    ZXY标准瓦片 发送反馈 SuperMap iServer .iEdge支持读取ZXY规范的地图瓦片,可对接 OpenStreetMap 等互联网的瓦地图服务.ZXY规范的地图瓦片规则如下:将地图全幅 ...