Arcpy批量生成FeatureClass的GLOBALID字段值(UUID)

【arcpy】 | 要素类、图层、要素集的区别 要素类是。 阅读详情

需求说明:有一批数据(比如,一个FileGDB文件,包含多个FeatureClass)需要为其指定字段添加GLOBALID即UUID值,使用Arcpy如下实现。

代码:

# -*- coding:gbk -*-
import  arcpy
import  uuid
if __name__=='__main__':
    arcpy.env.workspace=r'D:\Template.gdb'
    workspace = arcpy.env.workspace
    fcs = arcpy.ListFeatureClasses()
    for fc in fcs:
        fds = arcpy.ListFields(fc)
        for fd in fds:
            fdName = fd.name
            if fdName.upper()=='GLOBALID':
                 aValue = (str(uuid.uuid1())).upper()
                 print  ('{0}.GLOBALID: {1}'.format(fc,aValue))
                 code_block = """def CalcUUID():
    aValue=(str(uuid.uuid1())).upper()
    return aValue"""
                 arcpy.CalculateField_management(in_table= fc,field= fdName,expression="CalcUUID()",expression_type= 'PYTHON_9.3',code_block=code_block)

类似于在ArcMap中对各个图层分别进行如下处理:


使用Python(或Arcpy)只需要短短几行代码就完成了这种重复性的工作,且图层越多效率提升越明显。

以下是处理过程截图:


arcgis属性表利用python自动编码 该代码适合于根据其他属性的升序或降序来进行自动编码,操作简单 立即下载

相关推荐

告别算力焦虑:手把手教你用华为CloudMatrix384超节点部署MoE大模型(附xDeepServe配置)

本文详细解析了如何在华为CloudMatrix384超节点上高效部署MoE大模型,通过xDeepServe框架配置和专家分配优化,实现2300 Tokens/s的推理吞吐。文章涵盖环境准备、性能调优、成本平衡及容灾设计,帮助开发者告别算力焦虑,提升AI推理效率。

weixin_30790841的博客 449

ArcGIS 批量生成 UUID 作为唯一 ID

ArcGIS 批量生成 UUID 作为唯一 ID

shileimohan的专栏 2614

别再乱装了!Win10下NVIDIA显卡驱动、CUDA 11.0和cuDNN 8.0.5保姆级配置指南(含版本匹配避坑)

本文提供Win10下NVIDIA显卡驱动、CUDA 11.0和cuDNN 8.0.5的保姆级配置指南,详细解析版本匹配逻辑与安装步骤。从驱动选择到环境变量配置,再到框架测试,手把手教你避开常见坑点,确保深度学习环境一次配置成功。特别强调版本匹配的重要性,帮助开发者高效搭建GPU开发环境。

weixin_30600197的博客 310

ArcGIS给shp数据属性字段生成序列号、唯一id

原文:http://gisfun.xyz/?p=111 前言 在使用ArcGIS Desktop进行据处理时,有时我们需要给数据的某个字段进行唯一编号或者生成序列编号,这时我们可以用arcpy工具进行操作。 正文 首先我们在ArcMap中加载好shp数据,然后在工具条中打开Python窗口。 在打开的窗口中输入以下代码,即可对数据图层的Id字段设置32位的uuid值。 #引入arcpy import arcpy #引入python的uuid库 import uuid #获取“数据”图.

gisfun.xyz 1万+

从机械到数字:EC11旋转编码器与ESP32的PWM控制艺术

本文详细解析了EC11旋转编码器与ESP32的PWM控制技术,探讨了如何将机械旋转动作转换为精确的数字信号控制。通过硬件连接、信号处理和软件优化等实践技巧,开发者可以构建高效的人机交互系统,适用于智能照明、电机控制等多种应用场景。

android的专栏 791

autoDL算力云装Xinference[坑与步骤]

在页面直接点击下载会出现下着下载进度条消失,试了几次才出现这个报错,现在我们就继续安装缺少的包吧。这一步成功绕开了系统盘空间限制。先租用一个合适的服务器,建议不要选最新版本,跟我选的一样即可,不然后面会出现。最近在 AutoDL 上尝试部署。🚫 不要直接使用以下命令。点击下面链接即可打开。

ngadminq的博客 2395

ArcGis-字段计算器的使用方法与复杂应用--不定期更新建议收藏(计算字段、图形属性获取、关联计算、arcgis计算)

本文章主要介绍ArcGis中字段计算器的使用方法,使用技巧。主要讲解基础运用以及对复杂案例的分析。包括简单计算、文字处理、文字提取、图形属性提取、图形坐标提取、正则匹配、以及要素关联计算。

weixin_62354792的博客 1万+

Z-Image Turbo随机性增强插件的下载教程及使用方法 z-image生成图像太相似怎么办 Z-Image Turbo 整合包下载

Z-Image Turbo 是出了名的“seed 不敏感”,非常难做多样化图像创作。ComfyUi-ConditioningNoiseInjection 插件通过在conditioning(提示词编码)阶段加入可控噪声,成功解决了 Turbo 随机性不足的问题。它不仅能让 Turbo 产生更丰富的构图差异,还能保持主题稳定,是目前我测试过最有效的 Turbo 随机性增强工具。

代码简单说 Vue、JAVA、PHP、Node.js 熟练运用,接口、架构、性能全搞定。 2015

arcpy判断featureclass要素类的几何类型,点线面判断

arcpy判断featureclass要素类的几何类型,点线面判断

木易GIS的博客 663

【一看就会】Autoware.universe的“规划”部分源码梳理【0】——Planning综述(持续更新中)

单独开一篇planning综述,作为整个规划系列的开篇。本篇综述会持续更新,希望能帮助大家更好的整体理解规划部分。这个部分会持续更新。

weixin_48386130的博客 1968

【实战项目开发技术分享】机器人安全通过狭窄区域的方案

在机器人的应用领域中,有时会遇到需要机器人通过狭窄区域的情况。无论是室内还是室外,机器人需要具备适应性和灵活性,以便在狭窄的空间中进行安全、高效的导航。本文将提供一些如何让机器人通过狭窄区域的实现方案和思路,希望帮助读者可以根据实际的开发需要进行适当调整和扩展。

xiewf的博客 2万+

arcpy读取featureClass中某一字段的所有属性值,存放到list中(地理国情监测)

arcpy读取featureClass中某一字段的所有属性值,存放到list中: import arcpy shppath = r"F:\\IndexData.shp" #打印所有字段 fields = arcpy.ListFields(shppath) for f in fields: print f.name #提取shp文件中的'JH字段属性值 shpfields = ['JH'] shp_List = [] shprows = arcpy.SearchCursor(shppath, s

木易GIS的博客 2917

基于FreeRedis实现的.NET Redis客户端缓存缓存键条件优雅过滤

在.NET开发中,使用Redis作为缓存解决方案是很常见的。FreeRedis是一个功能强大的Redis客户端库,它提供了丰富的功能和灵活性,使我们能够轻松地与Redis进行交互。在本文中,我们将探讨如何使用FreeRedis实现缓存键条件的优雅过滤,以提高缓存的效率和准确性。

RzuScala的博客 331

ArcPy取得指定所有数据集中的FeatureClass

#取得指定用户名下的所有数据集,并取得指定名称的FeatureClass >>> file_names=('BOUAN','BOULK','BOUNT','BOUPT','CTRLK','CTRPT','HYDAN','HYDLK','HYDNT','HYDPT','PIPAN','PIPLK','PIPNT','PIPPT','RESAN','RESLK','RESNT','RESPT',

a_dev的专栏 3951

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

Arcpy学习笔记(五)-列出数据

1.ListDatasets: 摘要:列出工作空间中的所有数据集。可以针对数据集名称和数据集类型指定搜索条件,从而限制返回的列表。 说明:必须先设置工作空间环境,之后才能使用多个列表函数,这些列表函数包括 ListDatasets、ListFeatureClasses、ListFiles、ListRasters、ListTables 和 ListWorkspaces。 语法: 返回值: ListFeatureClasses: 摘要:列出工作空间的要素类、受名称、要素类型和可选要素数据集的

philosophy_jia的博客 2632

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

python2 arcpy.CreateFeatureclass_management()输入参数设置

【代码】python2 arcpy.CreateFeatureclass_management()输入参数设置。

Never Settle 1117

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

ArcPy学习笔记(二)访问空间数据

第二章 访问空间数据 1.检查数据的存在性 在使用ArcGIS中的工具时,当输入一个不存在的数据集,工具就会报错,在ArcPy中同样有Exists函数来判断数据集是否存在,返回一个布尔值(True/False)。它可以判断的有当前工作空间中的要素类、属性表、数据集、shp、工作空间、图层等其他文件。 arcpy.Exists(<database>) 下面这段代码是在确认该路径中的Panyu.shp文件是否存在 import arcpy a=arcpy.Exists("D:/PythonforA

c6983127的博客 1317

ArcGIS 10.2字段计算器Field Calculator批量条件赋值用法总结

花了几个小时专研这个批量处理,由于本人愚钝,所以费的时间较长,在网上搜的话,可以看到一大堆字段计算器按条件赋值的结果,但是就是没有人测试条件是汉字的哪一类。我利用网上的答案,就是直接用的一个if语句然后就可以直接出来英文或是数字的结果,但是对于汉字则没有办法。然后又参照一些其他的文档。知道了,在ArcMap中使用python时需要将其转为utf-8,这样便可以按条件查询了。 还有就是p...

3410

arcgis字段计算器使用rnd函数生成随机数

arcgis字段计算器使用rnd函数生成随机数 VB Script里 rnd应该是个函数,取0到1中的随机数,乘10再减去5就能保证结果在基准值左右。截图中为了要整数的结果,又取了个整,如果小数结果也可以直接rnd*n即可。Python应该更强大,但暂时不会用它取随机数,这个方法暂时够用了。 ...

BLUEHEART 6351

关于arcpy中Table,FeatureClass处理中常用工具整理

1、遍历工具: ListFeatureClasses ({wild_card}, {feature_type}, {feature_dataset}) ListTables ({wild_card}, {table_type}) 相关链接:http://help.arcgis.com/zh-cn/arcgisdesktop/10.0/help/index.html#/na/000v00000

白氏可乐python学习归纳区 3768

python 生成 uuid

uuid 作为通用识别码 ,在开发中经常被使用,本文主要介绍如何在python中生成 uuid,本文以https://blog.csdn.net/renyuanfang/article/details/86701148为主要示例将其转化成uuid python版本 import uuid # 创建一个uuid 对象,可以使用系统默认提供的 namespace = uuid.NAME...

renyuanfang的专栏 2417

Python 之 UUID

UUID是根据MAC以及当前时间等创建的不重复的随机字符串 import uuid # Generate a UUID from a host ID, sequence number, and the current time >>> uuid.uuid1() # Generate a UUID from the MD5 hash of a namespace UUID ...

weixin_33743703的博客 139

Arcpy神器之NumPyArrayToFeatureClass

Arcpy神器之NumPyArrayToFeatureClass 之前在“ofo数据获取&amp;amp;坐标转换&amp;amp;生成shp数据”一文中涉及到用Arcpy创建点要素数据,最近再次使用时发现怎么那么麻烦 于是有另辟新路,翻阅Arcpy接口文档,终于找到了一个神器NumPyArrayToFeatureClass。 我们先看看原来的写法 #创建shp点数据 def CreateFeaturc...

Anywalker 1766

Arcpy的使用总结a

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_33754065的博客 421

Memory Over Maps 论文讲解系列四:视觉记忆提取器SigLIP2

本文基于SigLIP2视觉模型,通过特征提取与FAISS向量索引实现机器人对历史关键帧的高效语义检索。作者设计统一接口的BaseFeatureExtractor基类,结合注册机制支持多模型扩展;具体实现中,SigLIP2FeatureExtractor将图像转为语义向量,经归一化后存入FAISS,支持快速相似度匹配。最终,系统可依据目标物体描述,从视觉记忆库中检索出最相关的Top-K关键帧,完成从“存储”到“按需检索”的关键跃迁。

snowful_world的博客 331
上一篇: Arcpy批量修改FileGDB中的FeatureClass和Table的指定字段
下一篇: Arcpy查找指定用户的所有要素类并列举其属性信息
acngiser
博客等级 码龄15年 118粉丝 214原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值