|
POST
|
There are no syntax errors, so this error message is somewhat perplexing. There are however other problems with your expression: You say you want to return the x coordinate, but you actually return the y coordinate. x is index 0. You calculate the vertex count of the whole multipart geometry and then return that index from the first part. That works for singlepart features, but it will give an error for multipart features, as vertex_count will be greater that the length of the first part. You can do it with a single line: // no need to convert to Dictionary, you can just call paths
// index -1 gets the last element of an array. paths[-1][-1] gets the last point of the last part.
return Geometry($feature).paths[-1][-1].x Try this expression. If the error still occurs, try setting the rule manually.
... View more
10-17-2022
12:51 AM
|
1
|
0
|
5367
|
|
POST
|
Yeah, I used the wrong value, sorry. Should have been Target Value instead of Destination Count And fair point about using Python. When I leave my current job and my scripts and tools stop working for some reason, nobody will be able to fix them. But then again, nobody would be able to fix ModelBuilder either. I'll just have to hope that they keep working...
... View more
10-14-2022
01:39 AM
|
1
|
0
|
2929
|
|
POST
|
Try using Calculate Value in front of the While. Make Destination Count and Updated Origin Count into variables and use this expression in Calculate Value: %Updated Origin Count% == %Destination Count% This will return True if the counts are equal. So choose that in the While block. Nevermind, your approach is better. Honestly, if you get to the point where you need iterations, wouldn't it be easier to just write a little Python script and package that in a script tool?
... View more
10-14-2022
01:07 AM
|
1
|
3
|
2957
|
|
POST
|
Sounds like a good enhancement, I just kudo'd your idea about this. I'm not aware of any plans in this regard, but the ESRI staff in the Arcade related ideas isn't very communicative.
... View more
10-13-2022
10:23 PM
|
1
|
0
|
3538
|
|
POST
|
There are two basic ways of doing this: Use a query This would be easier if the lots had a common attribute. But for so few features, you can also use the unique key of the lots (like a parcel id or object id or globalid). open the layer's property pane (double click or right click -> Properties) switch to Definition Query click on New definition query choose your key field, "includes the values", and then write in or select the values of your lots. Make a local copy You couldn't delete stuff in the layer, because you don't have thte persmission to do so. Imagine everyone being allowed to insert, change, or delete lots... But if you make a local copy, you can then delete everything you don't need. Righ click -> Data -> Export Features By default, it will save into the ArcGIS Project's default geodatabase. If you want to save as a Shapefile (.shp), choose a folder. Type in a name, click OK. Make
... View more
10-13-2022
04:53 AM
|
0
|
1
|
4060
|
|
POST
|
completed_surveys is a Featureset, a collection of features. You can only call the field name on single features. So you have to extract a feature from the featureset. One way to do it: var completed_surveys = ...
// just get the first feature
var survey = First(completed_surveys)
// we have to check that survey is not null, else we would produce an error
// by calling a member property of null
if(survey == null) {
Console("survey is null -> completed_surveys is empty")
} else {
Console(survey.job_wo)
}
... View more
10-13-2022
04:32 AM
|
2
|
0
|
3286
|
|
POST
|
Without a relationship class, you have to do the filtering yourself: // load the permit table
var all_permits = FeatureSetByPortalItem(...)
// get the permits that belong to the parcel
var parcel_id = $feature.GlobalID
var parcel_permits = Filter(all_permits, "ParcelID = @parcel_id")
// return a default value if no permits were found
if(First(parcel_permits) == null) {
return "No permits found for this parcel"
}
// build your output
var output = []
for(var p in parcel_permits) {
var line = `Permit ${p.PermitNumber}, issued on ${p.PermitDate} to ${p.PermitOwner}`
Push(output, line)
}
// conctenate and return
return Concatenate(output, TextFormatting.NewLine)
... View more
10-12-2022
01:48 AM
|
2
|
1
|
3563
|
|
POST
|
If a number is used for a feature in a class and then that feature is deleted, when a new feature is inserted does that number get reused or is it burned, and the next unused number comes up? The database sequence doesn't know and doesn't care about where its values are used. All it does is count up when you say so. So when you delete and then insert a feature, the sequence will count up. Just to clarify: The number isn't "burned", and the next number isn't "unused". These concepts would imply that the sequence has knowledge of where the values are used. It does not have that knowledge. It counts up. can the sequence be used in 'Calculate Field'? Yes. Personally, my unique key rules look like this: // Calculation rule on the key field
// triggers: Insert, Update
// if the key field is empty, get the next value of the sequence
// else return what's already in there
return IIF($feature.KeyField == null, NextSequenceValue("SequenceName"), $feature.KeyField)
... View more
10-11-2022
11:27 PM
|
2
|
2
|
2572
|
|
POST
|
It's probably doable with some tool (eg GenerateNearTable and then joining the output to the inputs somehow), but you can also rig up a quick script like this: in_features = "Points" # distance field will be added to this fc
near_features = "Polygons"
in_key = "polygon_id"
near_key = "id"
distance_field = "DISTANCE"
# read near_features as dictionary {key: geometry}
near_geometries = {key: shp for key, shp in arcpy.da.SearchCursor(near_features, [near_key, "SHAPE@"])}
# add field to in_features
arcpy.management.AddField(in_features, distance_field, "DOUBLE")
# calculate
with arcpy.da.UpdateCursor(in_features, [in_key, distance_field, "SHAPE@"]) as cursor:
for key, dist, shp in cursor:
try:
dist = shp.distanceTo(near_geometries[key])
except KeyError:
dist = None
print(f"key {key} could not be found in {near_features}.")
cursor.updateRow([key, dist, shp])
... View more
10-10-2022
05:28 AM
|
1
|
1
|
2654
|
|
POST
|
Something like this? // load the flood polygons from the map
var flood_polygons = FeatureSetByName($map, "FloodLevelLayer", ["WaterLevel"])
// get the first flood polygon that intersects this building (other will be ignored)
var flood_polygon = First(Intersects(flood_polygons, $feature))
// return a default value if there are no intersecting polygons
if flood_polygon == null) {
return "not affected by flooding"
}
// return the difference between the polygon's WaterLevel attribute and the $feature's Elevation attribute
return flood_polygon.WaterLevel - $feature.Elevation
... View more
10-07-2022
05:47 AM
|
0
|
0
|
1284
|
|
POST
|
Sum() takes a Featureset and a field als arguments. I included a Filter() to search for the value in the status field. var child_fs = FeatureSetByRelationshipName($feature, "ApplicationSite_TurfArea", ['Area', 'Status'])
var filterd_child_fs = Filter(child_fs, "Status = 'post inspection'")
return Sum(filterd_child_fs, "Area")
... View more
10-07-2022
05:36 AM
|
1
|
1
|
9461
|
|
POST
|
In a label? No. Labels don't allow access to other features or feature sets for performance reasons. In a popup? Yes. What exactly do you mean by "calculate the difference between features"? And how would you determine the other feature?
... View more
10-07-2022
03:55 AM
|
1
|
0
|
1307
|
|
POST
|
Be sure to reset the trigger, else the sequence field will be calculated every time you edit it: if($feature.trigger == "true") {
return {result: {attributes: {trigger: "false", sequence_field: NextSequenceValue("seq")}}
}
return
... View more
10-06-2022
09:37 AM
|
3
|
0
|
6549
|
| 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
|