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. BootStrap【一、概述】

    4月底出去浪了一圈,回来收了一周的心才收回来,5.12,重启自学 今天早上总算大概把JAVASpring相关的东西过了一边,Spring基础.IOC.AOP,看的有些头晕脑胀 公司项目除了Spring ...

  2. Image Processing and Analysis_8_Edge Detection:Multiresolution edge detection techniques ——1995

    此主要讨论图像处理与分析.虽然计算机视觉部分的有些内容比如特 征提取等也可以归结到图像分析中来,但鉴于它们与计算机视觉的紧密联系,以 及它们的出处,没有把它们纳入到图像处理与分析中来.同样,这里面也有 ...

  3. Python 爬虫实现天气查询(可视化界面版)

    github项目地址:StarMan Python 实现天气查询的程序早已完成,近日开学无课,昨晚心血来潮想做一个较为友好的界面版本,便匆忙行动了起来. 在之前已有的程序的基础上使用Tkinter 模 ...

  4. 洛谷P1462 通往奥格瑞玛的道路(SPFA+二分答案)

    题目背景 在艾泽拉斯大陆上有一位名叫歪嘴哦的神奇术士,他是部落的中坚力量 有一天他醒来后发现自己居然到了联盟的主城暴风城 在被众多联盟的士兵攻击后,他决定逃回自己的家乡奥格瑞玛 题目描述 在艾泽拉斯, ...

  5. 一步步实现ArcMenu效果

    先来看一下最终要实验的效果: 是不是跟国外的一款Path的菜单效果类似,这里的动画采用补间动画去实现,正而操练一下补间动画. 布局和子视图的测量处理: 新建一自定义View继承ViewGroup: 然 ...

  6. Python&Selenium 数据驱动【unittest+ddt】

    一.摘要 本博文将介绍Python和Selenium做自动化测试的时候,基于unittest框架,借助ddt实现数据驱动 二.测试代码 # encoding = utf-8 ""& ...

  7. Windows&Appium&Java&Python自动化测试-配置开发环境

    摘要 本篇博文,主要介绍借助Appium做移动端自动化测试的开发环境搭建,包括Java和Python Java环境:Appium+Maven+Idea+TestNG+Reportng Python环境 ...

  8. python一些方便excel行操作的函数(一)

    import collections class headhandler(): def __init__(self,mylist): self.mystorage={} self.mylist = m ...

  9. redistempalate的超时设置的操作更新

    redistempalate的超时设置时,一定要每次用set写入时,更新超时,默认是不会自动更新的. 例如: int tempTime = this.redisTemplate.getExpire(& ...

  10. python中函数的参数传递小结

    “”“ 函数的参数 --必须参数,默认参数,组合参数 --函数我作为参数 --对象作为参数 --*args  可变参数 --**kwargs关键字参数 “”” def function1(a,b,*a ...