|
POST
|
OK, so you want an Attribute Rule. These can only be written in Arcade, that's why you can't choose Python. Your formula would be z_start = geodetic_height_start - invert_elevation_start You have the invert_elevation from your feature and I assume you have the geodetic height as a DEM raster. Sadly, Arcade doesn't work with rasters (yet?), so you can't do this as an Attribute Rule. You can do it with a Python script / tool, but you would have to run that manually.
... View more
08-20-2021
06:03 AM
|
1
|
0
|
2042
|
|
POST
|
var dpa_fc = FeatureSetByName($datastore, "DirectProtectionAreas21_2")
... View more
08-19-2021
11:54 PM
|
0
|
1
|
7596
|
|
POST
|
FeatureSetByName needs the complete name of the feature class. If you're in a file geodatabase, thats probably just the name of the feature class (DirectProtectionAreas21_2). If you're in an Enterprise geodatabase, the full name is "DatabaseName.DataownerName.DirectProtectionAreas21_2", where you have to replace DatabaseName and DataownerName. Browse to the feature class in the catalog to see its full name:
... View more
08-19-2021
11:30 PM
|
0
|
0
|
7604
|
|
POST
|
@JoeBorgione& @DanPatterson : They are using the normal ArcGIS Pro Python window, just opening it in a slightly more cumbersome way. @zhongying_gan: You are using a custom Python environment (see where it says "arcgispro-py3-clone" in your error message) and the numpy package in this environment seems to be broken. Because arcpy needs numpy, it isn't imported on startup (so that you don't explicitly need to import it), that's why you get the "name not defined" error. Ways to fix this: reinstall the numpy package in your cloned environment (talk to your admin) go back to the default environment (see this link) as a last resort, reinstall ArcGIS Pro
... View more
08-19-2021
11:04 PM
|
2
|
0
|
5061
|
|
POST
|
You found a quite complicated example 🙂 // Calculation rule
// Suppression_repair_points, field DPA_AGENCY
// Triggers: Insert, Update
// optional:
// if DPA_AGENCY is already filled, just return its value (do nothing)
//if(!IsEmpty($feature.DPA_AGENCY)) {
// return $feature.DPA_AGENCY
//}
// load the polygon fc
var dpa_fc = FeatureSetByName($datastore, "database.dataowner.DirectProtection_areas")
// intersect the feature with the polyons
var dpa_inter = Intersects(dpa_fc, $feature)
// if the feature doesn't intersect a dpa polygon, return null
if(dpa_inter == null || Count(dpa_inter) == 0) {
return null
}
// grab the first intersecting polygon and return its DPA_AGENCY value
return First(dpa_inter).DPA_AGENCY
... View more
08-19-2021
10:48 PM
|
0
|
3
|
7622
|
|
POST
|
I'm sorry, but I can't really figure out what you're asking. You have a line FC with two fields storing the "invert elevation" of the line's end points and you want to convert thtem to z values. Am I correct in assuming "invert elevation" means "distance below ground" and "z values" means "distance above mean sea level"? Do you want the z values as new fields? to show up in a popup? to be stored in the line geometry (turn the FC into a z-aware FC)? Does it have to be Arcade (popup, attribute rule, etc) or can it also be done with Python?
... View more
08-19-2021
10:34 PM
|
0
|
2
|
2047
|
|
POST
|
Make sure your input data is formatted properly. In the last line, you use a comma as decimal separator, making it 4 columns as opposed to 3.
... View more
08-19-2021
09:58 PM
|
1
|
0
|
3066
|
|
POST
|
Code Block: def get_projected_extent(shape, wkid):
in_sr = shape.spatialReference
out_sr = arcpy.SpatialReference(wkid)
# get the extent
e = shape.extent
# convert the extent into a geometry
# either as polygon of all 4 points or as a diagonal polyline
e_points = [
arcpy.Point(e.XMin, e.YMin),
arcpy.Point(e.XMax, e.YMax),
]
e_geometry = arcpy.Polyline(arcpy.Array(e_points), in_sr)
# project the geometry and get the projected extent
e_proj = e_geometry.projectAs(out_sr).extent
return e_proj Field = get_projected_extent(!SHAPE!, 4326).XMax
... View more
08-19-2021
08:00 AM
|
2
|
1
|
4769
|
|
POST
|
# your input table and fields
in_fc = "..."
in_fields = ["OBJECTID", "RELID", "DATE", "AUTHORS"]
# your output table and fields
# this can be in_fc and in_fields, but for testing I suggest you create a new table...
# if you really need to copy ObjectID, you have to create a new field, FID in my example
out_fc = "..."
out_fields = ["FID", "RELID", "DATE", "AUTHORS"]
# index of the field that has to be split
# !python uses zero-based indexing!
split_field_index = 3
split_pattern = ", "
# read data
data = [list(row) for row in arcpy.da.SearchCursor(in_fc, in_fields)]
# optional: delete all rows from out_fc
# !!! if out_fc is the origin table of a relationship class, the foreign key in the related table will be set to Null !!!
arcpy.management.TruncateTable(out_fc)
with arcpy.da.InsertCursor(out_fc, out_fields) as cursor:
# loop through original data
for row in data:
split_field = row[split_field_index]
# split_field is empty? just copy the row
if split_field is None:
cursor.insertRow(row)
continue
# split split_field
split_values = split_field.split(split_pattern)
# loop through split_values and insert rows
for value in split_values:
row[split_field_index] = value
cursor.insertRow(row)
... View more
08-19-2021
02:09 AM
|
1
|
1
|
2966
|
|
POST
|
var cabs = FeatureSetByName($datastore, "Proposed_OLT_LCP_Boundaries_copy", ["cab_id"])
var cabsInt = Intersects(cabs, $feature)
// just check the intersected feature set
if (cabsInt == null || Count(cabsInt) == 0) {
return {"errorMessage": "Please edit inside a cabinet boundary"}
}
// filter cabsInt for your flagged polygon
var sdy_hut = First(Filter(cabsInt, "cab_id = 'SDY-HUT'"))
if (sdy_hut == null) {
return false
}
return true
... View more
08-18-2021
10:35 PM
|
0
|
0
|
1760
|
|
POST
|
Probably you missed the curly brackets when copying the code, but still: if ($feature.street_status==1 && $feature.street_id==null) {
return true;
}
return false; The problem with this code is the following: If you are inserting a street with street_status 2, it will return false, because you only check for street_status 1 and return false otherwise. This should work in those cases: if ($feature.street_status==1 && $feature.street_id!=null) {
return false;
}
return true; This defaults to returning true and only blocks the insert/edit on the combination you don't want. Other things to check: As Chris said: Is street_status numeric? Instead of the null check, you could try IsEmpty($feature.street_id)
... View more
08-18-2021
10:25 PM
|
1
|
1
|
2214
|
|
POST
|
Hmmm, sounds like Arcade doesn't like your field type... I'm out of my depth here, but there are a few things I'd try: Make sure your key field is a "normal" type. I couldn't find what field types are supported by Arcade, but Integer and Text fields are for sure. Make sure your primary key field is editable. The rule won't work on non-editable fields like ObjectID or GlobalID. Add new key fields and try the rule on those. Run this modified rule on a field in your feature class that is editable and not the primary key: // Calculation Attribute Rule
// Feature class, field NotPrimaryKey
// Triggers: Insert
// Get the new feature's key value
var return_value = $feature.NotPrimaryKey
var key = $feature.Pole
// If key is null, return early, don't create entries in the related tables
if(IsEmpty(key) || key == null) { return return_value }
return {
"result": return_value,
"edit": [
{
"className": "pTest6.GISPORTALADMIN.Elec_FIXTURE",
"adds": [
{"attributes": {"Pole": key}}
]
}
]
}
... View more
08-13-2021
12:09 AM
|
0
|
0
|
4371
|
|
POST
|
Glad to help. I did some searching regarding the formatting, and found that HTML does not like TextFormatting.NewLine at all Good to know. (Blank spaces are ignored, so I had to use text) You should be able to use non-breakable spaces. Just chain some " " together.
... View more
08-12-2021
10:11 PM
|
0
|
0
|
2276
|
|
POST
|
OK, so instead of filtering all documents at once, you need to cycle through the parcels and filter all documents for each parcel. I can't test this code, but it should be close: // load the tables
var table_a = FeatureSetByName($datastore, "Document_List")
var table_b = FeatureSetByName($datastore, "Relationship_table")
var table_c = FeatureSetByName($datastore, "Parcels_full_list")
// create output array
var output_lines = []
// filter parcels
var plot_id = $feature.ObjectID
var filtered_c =Filter(table_c, "Shape_ID_No = @plot_id")
// loop through parcels
for(var c in filtered_c) {
parcel_id = c.Parcel_ID_No
parcel_name = c.Parcel_Name
// get document ids for this parcel
var filtered_b = Filter(table_b, "Parcel_ID_No = @parcel_id")
if(filtered_b == null || Count(filtered_b) == 0) {
Push(output_lines, parcel_name + ": No documents")
continue
}
var doc_ids = []
for(var b in filtered_b) {
Push(doc_ids, b.BOOK_ID_No)
}
// get the document paths
var filtered_a = Filter(table_a, "OBJECTID IN @parcel_ids")
if(filtered_a == null || Count(filtered_a) == 0) {
Push(output_lines, parcel_name + ": No documents")
continue
}
var docs = []
for(var a in filtered_a) {
Push(docs, a.Hyperlink)
}
// format the output line for this parcel
Push(output_lines, parcel_name + ": " + Concatenate(docs, " | ")
}
// concatenate output_lines
return Concatenate(output_lines, TextFormatting.NewLine) As a side note: In my experience, it's very bad to rely on ObjectID as primary key. If for any reason you need to copy a feature or the whole feature class, the new ObjectIDs will be different, destroying your relationships. I've had this happen to me, recreating the relations was painful. I recommend: add manual primary key fields to your tables create database sequences for each primary key (Create Database Sequence) add this calculation rule to the primary key field of each of your tables: // field empty: return next sequence value
// else: return field value
return IIF(IsEmpty($feature["KeyField"]), NextSequenceValue("KeySequence"), $feature["KeyField"])
... View more
08-11-2021
11:55 PM
|
0
|
2
|
2284
|
|
POST
|
var g = Geometry($feature)
var fsLine = FeatureSetByName($datastore, "ssGravityMain", ["UPELEV"], true)
var fromLines = Intersects(fsLine , g)
if (fromLines == null || Count(fromLines) == 0) { return }
return $feature.RIMELEV - Min(fromLines, "UPELEV")
... View more
08-11-2021
10:48 PM
|
3
|
1
|
3696
|
| 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
|