|
POST
|
Hi @IvanKuzmic , Sorry for the delay in my reply. I was (and still am on vacation). You could try something like this: var relatedrecords = OrderBy(FeatureSetByRelationshipName($feature,"ActivitesMaster"), "Activity DESC");
var cnt = Count(relatedrecords);
var relatedinfo = "";
if (cnt > 0) {
for (var relatedrecord in relatedrecords) {
if (relatedinfo == "") {
relatedinfo = relatedrecord.Activity;
} else {
relatedinfo += TextFormatting.NewLine + relatedrecord.Activity;
}
}
}
return relatedinfo;
... View more
01-01-2021
02:21 PM
|
1
|
2
|
4951
|
|
DOC
|
Hi @RiannaAylward , Sorry for the delay in my reply, I was (and still am) on vacation. First of all, I have noticed some problems with this arcade expression after an update was applied to ArcGIS Online (more than a year ago), so it might not work anymore. However, the correct way of changing characters and create a valid URL is not using the Replace function, but the UrlEncode function as shown in the code. This function will replace any invalid characters by its valid representation in a URL: https://developers.arcgis.com/arcade/function-reference/text_functions/#urlencode
... View more
01-01-2021
02:14 PM
|
0
|
0
|
8189
|
|
POST
|
Hi @AmyRoust , Some time ago I read that it is more performant to have multiple functions on the same line since this would reduce the number of requests to the server. This is something Paul Barker mentioned in his blog: https://www.esri.com/arcgis-blog/products/mapping/mapping/whats-new-with-arcade-taking-a-stroll-through-featuresets-part-2/ On the other hand, I have never been able to confirm this. CC: @HusseinNasser2
... View more
12-07-2020
01:31 PM
|
0
|
1
|
3199
|
|
POST
|
Hi @DianaWilson1 , I would probably do something like this: var ratio = $feature["YR1_RATIO"]; // replace by field name in your data
if (IsEmpty(ratio)) {
return "no data";
} else if (ratio <= 0.65) {
return "less than or equal to 65%";
} else if (ratio <= 0.7) {
return "from 66% to 70%";
} else if (ratio <= 0.75) {
return "from 71% to 75%";
} else if (ratio <= 0.8) {
return "from 76% to 80%";
} else if (ratio <= 0.85) {
return "from 81% to 85%";
} else if (ratio <= 0.9) {
return "from 86% to 90%";
} else if (ratio <= 0.95) {
return "from 91% to 96%";
} else {
return "96% and higher";
}
... View more
12-03-2020
07:38 AM
|
0
|
1
|
3447
|
|
POST
|
Hi @DianaWilson1 , I'm glad it works. The ranges I used just sounded logical. 😉
... View more
12-02-2020
04:05 PM
|
0
|
3
|
3453
|
|
POST
|
Hi @DianaWilson1 , You can use something like this: var ratio = $feature.Ratio; // replace by field name in your data
if (ratio <= 0.65) {
return "less than or equal to 65%";
} else if (ratio <= 0.7) {
return "from 66% to 70%";
} else if (ratio <= 0.75) {
return "from 71% to 75%";
} else if (ratio <= 0.8) {
return "from 76% to 80%";
} else if (ratio <= 0.85) {
return "from 81% to 85%";
} else if (ratio <= 0.9) {
return "from 86% to 90%";
} else if (ratio <= 0.95) {
return "from 91% to 96%";
} else {
return "96% and higher";
}
... View more
12-02-2020
12:12 PM
|
1
|
5
|
3456
|
|
POST
|
Hi @PaulSweeney3 , I just did a test with the expression after copying the data to a local file gdb and ran the expression after changing the access by $datastore and the expression just works. It must be due to the portal access to the two layers that is causing the problem...
... View more
11-30-2020
02:47 PM
|
1
|
1
|
1804
|
|
POST
|
Hi @PaulSweeney3 , No luck here either, but I think it is due to the access to the pole and chambers featuresets. To compare in the pop-up the expression worked since I can access the layers from the map by their names. However, the map is not available in a Field Calculation and the chambers and poles are not in the same datastore. That is why I assume you tried to access the layers using FeatureSetByPortalItem. However, I don't think I am able to get access to these layers, since I am not part of the portal where the layers are stored. When you try your expression in a pop-up and you access the layers using FeatureSetByPortalItem, does the expression work, or does it return an error. I noticed the error when I try and do a Count on the layer to see if it returned something and that throws an error in my case.
... View more
11-30-2020
02:36 PM
|
1
|
2
|
1804
|
|
POST
|
Hi @PaulSweeney3 , I will give it a shot later on and post back any results.
... View more
11-30-2020
01:01 PM
|
1
|
3
|
1807
|
|
POST
|
Hi @PaulSweeney3 , Let me validate if I can perform the field calculation in ArcGIS Online. Can you confirm the output field name that should be filled with the result? If it does not work on ArcGIS Online, I can give it a shot and try to connect with ArcGIS Pro and perform the field calculation in Pro. Not sure if you have tried this already?
... View more
11-27-2020
06:46 AM
|
0
|
5
|
4865
|
|
POST
|
Hi @NoahLeimgruber , To include the min and max values in the range and also include the area of the polygon itself, you just need to change this line: if oid != oidcurr and lst[0] > h1 and lst[1] < h2: into this: if lst[0] >= h1 and lst[1] <= h2: This will assign a catchment area value to all polygons:
... View more
11-26-2020
11:26 AM
|
0
|
1
|
2565
|
|
POST
|
Hi @NoahLeimgruber , Looking a bit closer to the results I notice that in the Northern part there are some polygons with a huge catchment area. I also notice that they are summing the same polygon areas. If this is about catchments I don't think that this is hydrologically correct, but maybe the calculation has a different purpose.
... View more
11-26-2020
07:12 AM
|
0
|
1
|
5097
|
|
POST
|
Hi @NoahLeimgruber , It seems to be working: I did notice that there are some polygons that have -1 for the H1 and H2 values and many have an H2 values that is equal to H1 +1. When selecting only those polygons that are larger than H1 and smaller than H2, you will not get any resulting polygon and a catchment area of 0. Is that correct? The code I used is: def main():
# load arcpy
import arcpy
# set reference to the featureclass
fc = r'D:\GeoNet\CatchmentArea\Data.shp' # change this
# create dictionary with H values and areas
flds1 = ("OID@", "H1", "H2", "SHAPE@AREA")
dct = {r[0]: [r[1], r[2], r[3]] for r in arcpy.da.SearchCursor(fc, flds1)}
# start update cursor to write the catchment areas
flds2 = ("OID@", "Einzugsgeb")
with arcpy.da.UpdateCursor(fc, flds2) as curs:
for row in curs:
# read values
oidcurr = row[0]
# determine catchment area
catchment = SumAreaInRangeH(oidcurr, dct)
row[1] = catchment
curs.updateRow(row)
def SumAreaInRangeH(oidcurr, dct):
# function to determine catchment area
sumarea = -1
if oidcurr in dct:
# set reference values
h1 = dct[oidcurr][0]
h2 = dct[oidcurr][1]
sumarea = 0
for oid, lst in dct.items():
if oid != oidcurr and lst[0] > h1 and lst[1] < h2:
sumarea += lst[2]
return sumarea
if __name__ == '__main__':
main()
... View more
11-26-2020
06:53 AM
|
0
|
10
|
5098
|
|
POST
|
Hi @NoahLeimgruber , Thanks for sharing. I will have a look and post back any results or questions that may arrise.
... View more
11-26-2020
05:42 AM
|
0
|
11
|
5100
|
|
POST
|
Hi @PaulSweeney3 , Thanks for sharing the data. I noticed that you didn't include the web map so I don't have access to any other Arcade expression configured in the pop-up. I used the code I posted earlier and just changed to way to access the poles and chambers and this is returned in the pop-up: Can you indicate what should be changed?
... View more
11-26-2020
05:40 AM
|
0
|
0
|
4874
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 01-09-2020 09:26 AM | |
| 6 | 12-20-2019 08:41 AM | |
| 1 | 01-21-2020 07:21 AM | |
| 2 | 01-30-2020 12:46 PM | |
| 1 | 05-30-2019 08:24 AM |
| Online Status |
Offline
|
| Date Last Visited |
2 weeks ago
|