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. element随笔

    时间选择框el-date-picker和select框数据选不上: [解决]用v-model="searchData.searchDate",不能用:model="sea ...

  2. 01.Zabbix监控快速入门

    1.监控知识基本概述 1.为什么要使用监控 1.对系统不间断实时监控 2.实时反馈系统当前状态 3.保证服务可靠性安全性 4.保证业务持续稳定运行 2.如何进行监控,比如我们需要监控磁盘的使用率 1. ...

  3. 算法---FaceNet在Tf下的实战篇

    FaceNet---Tensorflow下的下的实战篇 @WP20190225 ===============目录=============== 一.FaceNet算法简介 二.FaceNet配置与使 ...

  4. Matlab---绘图中坐标系显示设置

    Matlab绘图---坐标系显示设置 [@wp20180507-20180511(week 5)] 目录: 一.设置坐标范围 二.修改坐标轴显示的刻度.密度.lable文字.位置等 三.Matlab绘 ...

  5. QQ气泡效果剖析

    对于QQ汽泡效果我想不用多说了,都非常的熟悉,而且当时这效果出来简直亮瞎眼了,挺炫的,这里再来感受下: 而这次只实现单个汽泡的效果,并不涉及到加入Listview上的处理,一步步来,先上一下最终这次要 ...

  6. C#原子操作(Interlocked.Decrement和Interlocked.Increment)

    一.概念 在多线程环境中,不会被线程调度机制打断的操作:这种操作一旦开始,就一直运行到结束,中间不会有任何 context switch (切换到另一个线程). 二.类 System.Threadin ...

  7. string::assign

    string (1) string& assign (const string& str); substring (2) string& assign (const strin ...

  8. CVE-2018-10933 LibSSH auth bypass

    漏洞原理 认证实现错误, 认证分为多个步骤,可以直接跳到成功的步骤       A vulnerability was found in libssh's server-side state mach ...

  9. Vue学习日记(三)——Vue路由管理vue-router

    前言 为了给读者更好的体验,去理解vue-router和下一篇介绍vuex,决定还是来一个实战教程来带大家更加的去深入理解vue-router,在这之前,读者先自行了解和去官网下载npm和node,附 ...

  10. 单独使用ibatis做事物控制。

    当项目中,只使用到了ibatis而没有使用spring来作为事物控制的时候,可以这样写: try { Reader reader = Resources.getResourceAsReader(&qu ...