|
POST
|
For that, you have to use PointGeometry # what you have
coordinates = (57.6222951, 18.8333582)
sr = 4326
# what you want
bearing = 345
distance = 2000
target_sr = 3006
# create a point geometry from the given coordinates and project it into the target coordinate system
y, x = coordinates
p = arcpy.PointGeometry(arcpy.Point(x, y), arcpy.SpatialReference(sr))
p_proj = p.projectAs(arcpy.SpatialReference(target_sr))
# get the target point geometry
p_target = p_proj.pointFromAngleAndDistance(bearing, distance)
# print coordinates
p_target.firstPoint
#<Point (728268.6981234621, 6395030.819025804, #, #)>
... View more
11-08-2022
06:41 AM
|
2
|
0
|
3280
|
|
POST
|
Make sure you have the correct geometry (especially z and m values). Make sure that your symbology shows all features.
... View more
11-08-2022
01:43 AM
|
0
|
0
|
5317
|
|
POST
|
The rule works perfectly for me. What's the problem? Doesn't it allow you to save the rule? Does deleting a feature give an error (screenshot please)? Can you delete a feature but it isn't copied? Something else? Things to check: You have to check the "exclude from application evaluation" checkbox The field for the rule should be empty for className, you have to use the complete name of the archive class. If you're working in an enterprise gdb, this is "Databasename.DataOwner.TableName" Obviously, make sure that the field names are correct
... View more
11-08-2022
01:38 AM
|
1
|
1
|
5324
|
|
POST
|
As Ken said, Clip() only works with an Envelope. You actually do want Intersection(). Maybe you confused it with Intersects(), which you will need, too. Intersects() has 2 signatures: Intersects(geometry1, geometry2) returns a boolean, depending on whether both geometries intersect. Intersects(geometry, featureset) returns a featureset of all features in the original featureset that intersect the query feature. Intersection() takes 2 input geometries and returns the intersection geometry. You can achieve what you want with something like this expression: // load the ownership polygons
var own = FeatureSetByName($map, 'EZG_Einleitungen', ['*'], true)
// get all features intersecting this county $feature
var i_own = Intersects(own, $feature)
// for each of those features, get the area of the intersection, accumulate
var total = 0
for(var o in i_own) {
total += Area(Intersection(o, $feature), "Acres")
}
total = Round(total, 1)
return `This organization owns ${total} acres in this county.`
... View more
11-07-2022
11:15 PM
|
1
|
0
|
2200
|
|
POST
|
Depending on the length of your lines, you might want to use LengthGeodetic() instead of Length() to account for Earth's curvature.
... View more
11-07-2022
10:55 PM
|
0
|
0
|
7967
|
|
POST
|
You can use this expression as Attribute Rule (triggers on Insert & Update) or in a popup: // load the line fc
var lines = FeaturesetByName($datastore, "TestLines")
// get all intersecting lines
var i_lines = Intersects($feature, lines)
// for each intersecting line, get the length of the intersection, accumulate
var total = 0
for(var line in i_lines) {
total += Length(Intersection(line, $feature))
}
return total
... View more
11-07-2022
10:50 PM
|
1
|
2
|
7967
|
|
POST
|
Take a look at Intersection(). For example: Calculate a field in the line feature class: var polygons = FeaturesetByName($datastore, "TestPolygons")
var polygon = First(Intersects(polygons, $feature))
if(polygon == null) { return null }
var i_line = Intersection(polygon, $feature)
return Length(i_line) Label the line with this expression `line: ${Round(Length($feature))} meters\nintersection: ${Round($feature.DoubleField)} meters` Result:
... View more
11-04-2022
07:01 AM
|
1
|
3
|
8024
|
|
POST
|
Hmm, it worked for my test data. Can you post your related table (the actual table or a screenshot of the label field)
... View more
11-04-2022
12:40 AM
|
0
|
1
|
1661
|
|
POST
|
For a one-time calculation: use Calculate Field on Pole.ACCIDENTCOUNT, switch to Arcade // get the repair history for this pole
var repair_history = FeaturesetByRelationshipName($feature, "RelationshipName")
// get the repairs due to car accidents
var car_accidents = Filter(repair_history, "CARACCIDENT = 'Yes'")
// count and return
return Count(car_accidents) For automatic calculation: Create a Calculation Attribute Rule on PoleRepairHistory // triggers: Insert
// field: empty
// if this repair is not due to a car accident, abort
if($feature.CARACCIDENT != "Yes") { return }
// get parent pole
var pole = First(FeaturesetByRelationshipName($feature, "RelationshipName"))
if(pole == null) { return } // no related pole found, abort
// add 1 to the current accident count
var new_count = pole.ACCIDENTCOUNT + 1
// instead of returning a value, we can return a dictionary with specified keys
// to edit other tables
// https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/attribute-rule-dictionary-keywords.htm
return {
"edit": [{
"className": "Pole", // full class name
"updates": [{
"globalID": pole.GlobalID, // if the fc doesn't have GlobalIDs, use ObjectID instead
// "objectID": pole.OBJECTID,
"attributes": {"ACCIDENTCOUNT": new_count}
}]
}]
}
... View more
11-03-2022
08:04 AM
|
0
|
0
|
2682
|
|
POST
|
OK, so you have a point fc with attachments, and you want buffers with attachments, is that correct? Maybe you could use what you have so far, but I'm not sure without knowing more. There could be all sorts of problems with the 1:m joins you did. If possible, I'd start fresh. Buffer the point fc Add GlobalID to the polygon fc Enable Attachments on the polygon fc Use this script to copy the attachments points = "path:/to/point_fc"
polygons = "path:/to_polygon_fc"
in_folder = "path:/to/in_folder" # folder where the attachments are (or will be) exported
from pathlib import Path
# get a dict {GlobalID: ObjectID} for the point fc
guid_to_oid = {guid: oid for guid, oid in arcpy.da.SearchCursor(points, ["GlobalID", "OBJECTID"])}
# get a dict {OldObjectID: NewGlobalID}
oid_to_new_guid = {oid: guid for guid, oid in arcpy.da.SearchCursor(polygons, ["GlobalID", "ORIG_FID"])}
# create the match table
match_table = arcpy.management.CreateTable("memory", "MatchTable")
arcpy.management.AddField(match_table, "Filename", "TEXT")
arcpy.management.AddField(match_table, "MatchID", "GUID")
# export the old attachments and fill the match table
points_attach = points + "__ATTACH"
in_folder = Path(in_folder)
with arcpy.da.InsertCursor(match_table, ["Filename", "MatchID"]) as i_cursor:
with arcpy.da.SearchCursor(points_attach, ["REL_GLOBALID", "ATT_NAME", "DATA"]) as s_cursor:
for rel_gid, att_name, data in s_cursor:
# get attachment path
att_path = in_folder / att_name
# export (delete this line if you already have exported)
att_path.write_bytes(data)
# map from old rel_globalid (points.GlobalID) to polygons.GlobalID
old_oid = guid_to_oid[rel_gid]
new_rel_gid = oid_to_new_guid[old_oid]
# insert into match table
i_cursor.insertRow([str(att_path), new_rel_gid])
# Add attachments to polygon fc
arcpy.management.AddAttachments(polygons, "GlobalID", match_table, "MatchID", "Filename")
... View more
11-03-2022
07:49 AM
|
0
|
1
|
4778
|
|
IDEA
|
Hi, welcome to the ESRI Community! Please take a look at the Ideas Submission Guidelines and tell us what your idea is about, because right now, we can't tell.
... View more
11-03-2022
04:16 AM
|
0
|
0
|
1180
|
|
POST
|
def FindLabel ( [GewässerID] , [OBJECTID]):
import arcpy
key_val = [GewässerID]
label_1 = [OBJECTID]
rel_table = 'path:/to/related/table'
rel_key_field = "GewässerID"
rel_label_field = "SegmentTyp"
where = f"{rel_key_field} = {key_val}"
rel_values = [r[0] for r in arcpy.da.SearchCursor(rel_table, [rel_label_field], where)]
distinct = list(set(rel_values))
numbers = [rel_values.count(d) for d in sorted(distinct)]
label_2 = ", ".join([f"{n} {v}" for n, v in zip(numbers, distinct)])
return f"{label_1}: {label_2}"
... View more
11-03-2022
03:37 AM
|
1
|
3
|
1690
|
|
POST
|
I'm not quite sure what you're doing here... This seem to be either a modified attachment table or the attachment table joined to the feature class. And now you want to add new attachments based on the name of the attachments that are already present? Anyway, the original script matches files whose names (without extension) match the key field value or start with that value followed by an underscore. Your name field includes the extension, so the script doesn't find any matching files. Change line 24 of the original script: key = str(row[0]).split(".")[0] This will split the value in the key field at the dot and take that first part, which is the name without extension.
... View more
11-02-2022
01:43 PM
|
0
|
3
|
4787
|
|
POST
|
Can you please post screenshots of your in_table, at least the name field the files in your photo folder, ideally showing some files that belong to the same row
... View more
11-02-2022
08:31 AM
|
0
|
5
|
5424
|
|
POST
|
// get all intersecting lines
var lines = FeaturesetByName($datastore, "TestLines")
var i_lines = Intersects(lines $feature)
// loop thorugh those lines, return true if any end point intersects $feature
for(var line in i_lines) {
var end_point = Geometry(line).paths[-1][-1]
if(Intersects(end_point, $feature)) {
return true
}
}
// no end point intersects $feature
return false
... View more
11-02-2022
04:28 AM
|
1
|
0
|
2073
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 01-30-2023 09:57 AM | |
| 1 | 05-18-2023 12:51 AM | |
| 1 | 03-05-2023 12:46 PM | |
| 1 | 12-07-2022 07:01 AM | |
| 1 | 06-21-2022 08:27 AM |
| Online Status |
Offline
|
| Date Last Visited |
02-03-2024
06:14 PM
|