|
POST
|
OK. For the start point: // Calculation Attribute Rule on the line fc
// field: upstreammanhole
// triggers: insert(, update)
// load the manholes
var manholes = FeaturesetByName($datastore, "Database.DataOwner.Manholes", ["uniqueID"], false)
// get the line's start point
var p = Geometry($feature).paths[0][0]
// find the intersecting manhole
var manhole = First(Intersects(p, manholes))
// return a default value if no manhole intersects, else return the manhole's uniqueID
return IIf(manhole == null, null, manhole.uniqueID) For the end point, copy the rule and replace line 9: var p = Geometry($feature).paths[-1][-1] You can also do both points in one rule. To do that, leave the field parameter of the Attribute RUle empty. // Calculation Attribute Rule on the line fc
// field: empty!
// triggers: insert(, update)
// load the manholes
var manholes = FeaturesetByName($datastore, "Database.DataOwner.Manholes", ["uniqueID"], false)
// get the line's start and end points
var start = Geometry($feature).paths[0][0]
var end = Geometry($feature).paths[-1][-1]
// find the intersecting manholes
var start_manhole = First(Intersects(start, manholes))
var end_manhole = First(Intersects(end, manholes))
// instead of returning a value, return a dictionary
return {
result: {
attributes: {
upstreammanhole: IIf(start_manhole == null, null, start_manhole.uniqueID),
downstreammanhole: IIf(end_manhole == null, null, end_manhole.uniqueID),
}
}
}
... View more
02-03-2023
02:31 PM
|
1
|
0
|
2107
|
|
POST
|
Almost. inserts MAIN ST, MAIN ST, FIRST ST into an array at index 0? It inserts those values into the array, but not all at index 0, because you increase the index inbetween. line 4: StreetIntersection is now a feature set with 3 features. The values of the STREET_NAME field of those features are "Main Street" (2x) and "First Street" line 8: iterate over StreetIntersections count = 0; f.STREET_NAME = "Main Street"; arr = ["Main Street"] count = 1; f.STREET_NAME = "Main Street"; arr = ["Main Street", "Main Street"] count = 2; f.STREET_NAME = "First Street"; arr = ["Main Street", "Main Street", "First Street"] If you would insert each value at index zero (which would be wrong!), the array would look like this: ["Main Street"] ["Main Street"] ["First Street"] This is because you are not "inserting" an element as in "take everything that already is in the array and add this element". You are actually setting the element at that index, regardless of what was at that index before. It's just that if the index is equal to the array length, a new element is appended (length 0 -> index 0 -> add first element; length 1 -> index 1 -> add second element). This means you can also change an element at an index that is not the last element: var arr = [1, 2, 3]
arr[1] = 5 // [1, 5, 3]
arr[0] = "a" // ["a", 5, 3] For actually inserting elements, there are the functions Push(array, element) and Insert(array, index, element). var arr = [1, 2, 3]
Push(arr, 4) // [1, 2, 3, 4] var arr = [1, 2, 3]
Insert(arr, 1, 4) // [1, 4, 2, 3]
... View more
02-03-2023
02:15 PM
|
1
|
0
|
4465
|
|
POST
|
Do you have empty id values? In that case, your query would be "ID = ", which is an invalid query. var id = $feature.ID
if(id == null) { return false } // feature is invalid if no id
var tbl = FeaturesetbyName($datastore, "IDs", ["ID"], false);
var query = "ID = @ID"; // try using this notation instead
var countID = Count(Filter(tbl, query));
return countID == 1 // valid if exactly 1 feature has this ID, else invalid
... View more
02-03-2023
04:55 AM
|
0
|
1
|
1756
|
|
POST
|
It doesn't work because you're not comparing to a date. Instead you compare a date (a very large number - milliseconds since January 1, 1970 UTC) to a very small number (1/4/2024 = 0.00012). Instead, you have to compare to actual dates: // month is 0 based -> January = 0, April = 3
var financialYear = When(
dates >= Date(2023, 3, 1) && dates < Date(2024, 3, 1), "2023/2024",
// ...
"None") This is very cumbersome. A better way: var dates = $feature.TargetExchange
var y = Year(dates)
var m = Month(dates)
return IIf(
m >= 3, // if after April
`${y}/${y+1}`, // use "current/next"
`${y-1}/${y}`) // else use "previous/current"
... View more
02-03-2023
04:22 AM
|
3
|
1
|
1630
|
|
POST
|
Can points intersect the line only at the end vertices or anywhere else, too? If both start and end vertex intersect a point, which point's value do you want to return?
... View more
02-02-2023
10:01 PM
|
0
|
1
|
2127
|
|
POST
|
The Community's email address is handled separately from you AGOL account. Not the most intuitive decision, and there probably should be a note in the Community settings... You have to contact the Community team at [email protected] , they'll change it for you.
... View more
02-02-2023
12:35 PM
|
1
|
2
|
2354
|
|
POST
|
For operators (++ etc): https://developers.arcgis.com/arcade/guide/operators/ For data types (eg array): https://developers.arcgis.com/arcade/guide/types/ For your example expression: arr is an array, a collection of elements. You can address a specific element by using its index, starting at 0 for the first element: var arr = ["a", "b"]
Console(arr[0]) // "a"
Console(arr[1]) // "b"
arr[2] = "c"
Console(arr) // ["a", "b", "c"] += is an operator that takes a value and adds another value to it. Basically, it's short way of writing this: var x = 0
x = x + 5 // add 5 to x
x += 5 // do it again, but shorter ++ is an operator that increases the variable by 1: var x = 0
// These all do the same thing:
x = x + 1
x += 1
x++ So, if we step through your expression: line 6: create an empty array line 7: create a variable that will function as array index line 8: iterate over the featureset line 9: set the array element at the current index line 10: increase the index by 1 You could combine lines 9 and 10: arr[count++] = (f.STREET_NAME) As a side note: It's best not to use function names like Count as variable names. If you wanted to return the number of elements in your array, normally you would call Count(arr). But you can't do that anymore, because you changed Count from a function to a number.
... View more
02-02-2023
12:17 PM
|
3
|
0
|
4480
|
|
POST
|
A basic approach: # This will try to rename your feature classes, be sure that you really want that!
arcpy.env.workspace = "C:/your_database.sde" # database connection of the data owner (dbo in your example)
for fc in arcpy.ListFeatureClasses() + arcpy.ListTables():
name = fc.split(".")[-1]
new_name = "County_" + name
try:
arcpy.management.Rename(fc, new_name)
except Exception as e:
print(f"Could not rename {fc} to {new_name}: {e}") To filter what classes and tables you rename: ListFeatureClasses—ArcGIS Pro | Documentation ListTables—ArcGIS Pro | Documentation
... View more
02-02-2023
08:56 AM
|
1
|
1
|
1308
|
|
POST
|
Field—ArcGIS Pro | Dokumentation Although the Field object's type property values are not an exact match for the keywords used by the Add Field tool's field_type parameter, all of the Field object's type values can be used as input to this parameter. The different field types are mapped as follows: Integer to LONG, String to TEXT, and SmallInteger to SHORT. if field.name == x and field.type == "String"
... View more
02-02-2023
12:53 AM
|
0
|
1
|
1168
|
|
POST
|
There are two main ways to add attachments to a feature: Using the Attribute Pane in ArcGIS Pro to manually add attachments to single features: Add or remove file attachments—ArcGIS Pro | Documentation Using the tool Add Attachments to add attachments to multiple features: Add Attachments (Data Management)—ArcGIS Pro | Documentation To use the Add Attachments tool, you need an Attachment Match Table, which you can generate in a previous step with Generate Attachment Match Table (Data Management)—ArcGIS Pro | Documentation The Match Table is not the Attachment table. The Match Table is not associated with the feature class. The behavior you see is completely correct. The Match Table is just an intermediate step, it can be deleted after you used it in the Add Attachments tool. Let's look at an easy example for how to add multiple attachments to a feature class. Let's say you have a polygon feature class of lots. This feature class has a text field called LotID with values like "LotA", "LotB", etc. Now you want to add some reports to these lots. Enable attachments for the feature class. Enable Attachments (Data Management)—ArcGIS Pro | Documentation Put the reports you want to attach into a folder, name them according to the LotID values -> "LotA.pdf" Generate the Match Table Generate Attachment Match Table (Data Management)—ArcGIS Pro | Documentation use LotID as key field, output match table can be anywhere (but not the attachment table!) The Match Table should look like this: LotID Path LotA C:/reports/LotA.pdf LotB C:/reports/LotB.pdf Add the attachments to the feature class Add Attachments (Data Management)—ArcGIS Pro | Documentation Use the table you generated in the previous step as match table, use LotID as join field The Match Table is unneccessary now, you can delete it. For more on how to work with attachments, take a look at the docs: An overview of the Attachments toolset—ArcGIS Pro | Documentation
... View more
02-02-2023
12:45 AM
|
2
|
1
|
4251
|
|
POST
|
var size = $feature.height * 6.66
return `<FNT size='${size}'>${$feature.textstring}</FNT>` https://developers.arcgis.com/arcade/guide/template-literals/
... View more
02-01-2023
08:25 AM
|
0
|
0
|
2397
|
|
POST
|
pole_fc = "TestPoints2"
sub_fc = "TestPoints"
line_fc = "TestLines"
common_field = "IntegerField"
# read the pole shapes
pole_dict = {
id: shape
for id, shape in arcpy.da.SearchCursor(pole_fc, [common_field, "SHAPE@"])
)
# start inserting into the line fc
with arcpy.da.InsertCursor(line_fc, ["SHAPE@"]) as i_cursor:
# loop over the sub fc
with arcpy.da.SearchCursor(sub_fc, [common_field, "SHAPE@"]) as s_cursor:
for id, shape in s_cursor:
# get the corresponding pole, skip if not found
try:
pole = pole_dict[id]
except KeyError:
continue
# construct and insert the new line
line_shape = arcpy.Polyline(arcpy.Array([pole.firstPoint, shape.firstPoint]), pole.spatialReference)
i_cursor.insertRow([line_shape])
... View more
02-01-2023
08:05 AM
|
1
|
0
|
2258
|
|
POST
|
var size = $feature.OBJECTID
return `<FNT size='${size}'>Test</FNT>`
... View more
02-01-2023
07:48 AM
|
0
|
2
|
2422
|
|
POST
|
I am would like to merge 2 or more point layers within a feature class to 1 layer. You say that you want to do this with the interactive Merge tool in the Edit tab, so I'm assuming you mean point features, not layers. A feature is one row in your feature class. A layer is the representation of your feature class in ArcGIS Pro (used for symbology, labels, selections, etc.). Sorry if that sounds nitpicky, but that's why the others assume you want to merge feature classes. Anyway, Dan's answer is really close: You can't merge Points, only Multipoints. So you have to convert your point feature class into a multipoint feature class first: Use the Pairwise Dissolve tool to turn your point feature class into a new multipoint feature class. Toolboxes -> Analysis -> Pairwise Overlay -> Pairwise dissolve choose all fields as Dissolve fields make sure the "Create multipart features" checkbox is marked Select all features in the new feature class and run the interactive Explode tool in the edit tab This new feature class is a multipoint featureclass, you can merge your point features here.
... View more
02-01-2023
01:16 AM
|
2
|
0
|
9488
|
|
POST
|
Here we have a boring old random color scheme for our unique values: When we select some unique values and change the color scheme, the new scheme only applies to the selected categories: But it's still random. To make it a ramp, we have to change the scheme: To learn more: Color schemes—ArcGIS Pro | Documentation
... View more
01-31-2023
06:16 AM
|
0
|
5
|
2404
|
| 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
|