帖子
|
您试图使用层列表作为输入,但该工具需要一个层。因此,您必须创建输出fc并遍历SampleLines,并将结果附加到oputput fc。或者你可以用InsertCursor来做。在这一点上,你可以采取下一个逻辑步骤,跳过所有的工具,只使用几何方法。input_point_fcs = ["TestPoints"]轴承=[0,90,180,270,45]距离= [50,100,150,200]output_folder = "memory" output_name = "result" output_fc = arcpy.management。CreateFeatureclass(output_folder, output_name, "POINT")AddField(output_fc, "Source", "TEXT")AddField(output_fc, "Bearing", "DOUBLE")AddField(output_fc, "Distance", "DOUBLE")与arcpy.da。InsertCursor(output_fc, ["SHAPE@", "Source", "Bearing", "Distance"]) as i_cursor: for point_fc in input_point_fcs: with arcpy.da。搜索Cursor(point_fc, ["SHAPE@"]) as s_cursor: for point, in s_cursor: for bearing in bearings: for distance in distances: new_point = point.pointFromAngleAndDistance(bearing, distance) i_cursor.insertRow([new_point, point_fc, bearing, distance])
...查看更多
3小时前
|
0
|
0
|
134
|
帖子
|
#而不是一个DataFrame,定义你的数据为一个简单的二维列表rows = [] column_names = ["DomainName", "DomainType", "Index", "Code", "Description", "Min", "Max"] #填充列表域在domains: if domain。domainType == "Range": row = [domain.name, domain.name]。domainType, 0, None, None, domain。区间[0],域。range[1]] rows.append(row) else: for i, (k, v) in enumerate(domain. codedvalues .items()): row = [domain.name, domain. properties ()]domainType, i, k, v, None, None] rows.append(row) # convert to DataFrame DataFrame = pd。DataFrame(rows, columns=column_names) # export DataFrame .to_csv("N:/文件夹/domains.csv", index=False) DataFrame .to_excel("N:/文件夹/domains.csv", index=False)
...查看更多
4小时前
|
1
|
0
|
11
|
帖子
|
你在relativeDelta中输入一个字符串。试试这些:numMonths = arcpy.GetParameter(3) numMonths = int(arcpy.GetParameterAsText(3))
...查看更多
昨天
|
1
|
1
|
12
|
的想法
|
呕……我脑海中浮现出一些不连贯的观点:现场计算器在目前的状态下已经足够笨拙了。我们在这里经常遇到关于语法的问题,特别是对于不使用GUI,但在脚本中调用计算器的用户(必须以字符串形式提供表达式)。如果你在这里引入正则表达式,你可能会得到很多关于它的问题。正则表达式是……我们说“不是最直观的”。我绝不是一个高级用户,但我在某些情况下使用过它。我还是不知道我在做什么。我使用过的每一个正则表达式都是受到在线搜索和regex101长时间会话的启发。如果我现在看其中的一些表达,我只知道他们应该找到什么,因为我记录了它。 I feel like the complicated syntax would stop many users cold in their tracks, leading to frustration and to them just using string.replace() anyway. Who's your audience here? I think most users who both know of regex and consider using it know enough about Python to either import re in the calculator or skip the calculator altogether and go straight for the UpdateCursor. On the other side, there's a big chance that users who are not as experienced in Python (or programming in general) have never even heard of regex. Swamping those users in regex syntax doesn't seem like a good idea to me. So, personally, I think it would lead to much confusion for little benefit. Having said that, I don't know how QGIS does this. Maybe I'm making up problems and there are good ways of avoiding that confusion...
...查看更多
|
0
|
0
|
38
|
帖子
|
字体标记已弃用。相反,颜色应该用css定义,或者在样式表中(对于弹出式窗口是不可能的),或者作为内联样式。当我现在测试时,MapViewer自动将字体标记转换为具有适当颜色的span标记,但仅适用于颜色名称和十六进制代码,而不适用于rgb值。但是当您使用正确的语法时,这些仍然有效。红色, 绿色, Red, Green, Blue
Using rgb: Red, Green, Blue ...查看更多
昨天
|
0
|
1
|
35
|
帖子
|
你可以在图层上激活时间功能。你似乎至少在你的一个图层上(无意中)这样做了。去激活:进入图层属性,切换到时间选项卡,切换图层时间属性为“No Time”。对每一层都这样做。我不知道为什么你会在新项目和旧项目上看到时间线。你在多个项目中使用保存的图层文件吗?
...查看更多
昨天
|
0
|
0
|
14
|
帖子
|
您可以在getParameterInfo()和updateParameters()中更改参数的状态和值。您可以在updateMessages()中更改参数警告和错误。在你的情况下,你会这样做:class SomeTool: label = "SomeTool" def getParameterInfo(self): #定义参数parameters = [arcpy.Parameter(…),arcpy.Parameter(…),arcpy.Parameter(…),]#更改默认值,过滤器和可见性参数[0].filter。[1]. List =[1,2,3]个参数。enabled = False参数[2].参数说明value = "default"返回参数def updateParameters(self, parameters): if参数[0]。取值== 1:参数[1]。enabled = True else:参数[1]。enabled = False def updateMessages(self, parameters): parameters[0]。欲了解更多信息,请参阅官方文档:https://pro.arcgis.com/en/pro-app/latest/arcpy/classes/parameter.htm
...查看更多
周三
|
0
|
1
|
14
|
帖子
|
从田野来看,你是在手掌调查表上写这个表达式的。但它应该是为手掌层编写的。
...查看更多
周三
|
0
|
0
|
11
|
帖子
|
啊。据我所知,没有办法动态地做到这一点。我能想到的唯一方法就是使用静态定义的周期。所以你的用户不能过滤“这两个任意日期之间的每一个点”,只能过滤“这个预定义时间段内的每一个点”。要做到这一点,您可以使用此数据表达:/ / var加载点p =门户(“https://xxx/portal/”)var id =“abc”var子层= 1 var date_field =“Zeitstempel”var层= FeaturesetByPortalItem (p id、子层(date_field),真的)/ /定义输出var output_dict = {geometryType: "字段:[{名称:“时期”,类型:“esriFieldTypeString”},{名称:“TotalArea”,类型:“esriFieldTypeDouble”},),功能 : [] } // 时间定义为字典{period_name:[start, end]} //下面的Union()函数花费了很多时间,所以不要使用太多的句点!var时间={" 2020 ":[日期(2020 0 1),日期(2020年11日31)],“2021”:[日期(2021 0 1),日期(2021年11日31)],“2022”:[日期(2022 0 1),日期(2022年11日31)],“2023”:[日期(2023 0 1),日期(2023年11日31)],“2020 - Q1”:[日期(2020 0 1),日期(2020年2 31)],“2020 - Q2”:[日期(2020 3 1),日期(2020、5、30)],“2020年第三季”:[日期(2020、6、1),日期(2020、8 30)],“2020年第四季度”:[日期(1)2020年,9日,日期(2020年11日31)],}/ /遍历的时期(var在页){/ var /过滤器你点开始=时间[p] [0] var =结束时间[p] [1] var sql = ' $ {date_field} > = @start和$ {date_field} < = @end ' var filtered_layer =过滤器(层,sql) / / var每个点缓冲缓冲区= [](var filtered_layer f){推(缓冲,缓冲(f 10米))}/ /联盟所有缓冲区var unioned_buffers =联盟(缓冲区)/ var /写新特性new_f ={属性:{时期:p, TotalArea: Area(unioned_buffers, "㎡")}}Push(output_dict. txt)features, new_f)} // return the featureset return featureset (Text(output_dict))将指示器的值设置为TotalArea的Sum。 Instead of the date selector, use a category selector. Use your period names as categories. As action, filter the indicator's Period field. Now your users can filter by the periods you defined and get the unioned areas.
...查看更多
周三
|
0
|
0
|
12
|
帖子
|
Dan的回答的快速实际应用:土地=“土地”#层名或fc路径#转换顶点为点land_points = arcpy.management。featureverticestpoints (land, "memory/land_points", "ALL") #为顶点创建Thiessen多边形#我假设你可以使用平面计算!如果你需要测地线,用别的。Thiessen = arcpy.analysis。CreateThiessenPolygons(land_points, "memory/thiessen", "ALL") #溶解thiessen多边形->岛屿之间的中心线中心线= arcpy.management。溶解(thiessen, "memory/centerlines", "ORIG_FID") #创建缓冲区bufferlines = arcpy.analysis。缓冲区(土地,"memory/bufferlines", "3 miles") #相交缓冲区和中心线相交= arcpy.analysis。相交([bufferlines,中心线],"memory/ Intersect ") #溶解为ORIG_FID (Land_OID ->顶点)和ORIG_FID_1 (Land_OID ->缓冲区)基线= arcpy.management。溶解(相交,"memory/baseline ", ["ORIG_FID", "ORIG_FID_1"]) #最后,删除所有与arcpy.da不匹配的特征。UpdateCursor(基线,["OID@"], "ORIG_FID <> ORIG_FID_1")作为游标:对于游标中的行:cursor. deleterow()红色勾勒的岛屿,黄色显示的基线:
...查看更多
周二
|
1
|
0
|
37
|
标题 | 荣誉 | 发布 |
---|---|---|
1 | 4小时前 | |
1 | 昨天 | |
1 | 周二 | |
1 | 周二 | |
1 | 周二 |