|
POST
|
Hi Nico Luus , As you mentioned, there might be an issue with the Contains function (at least it seams that way). I would recommend you to contact Esri Support and work with them to report the issue.
... View more
09-30-2020
07:17 AM
|
1
|
0
|
2770
|
|
POST
|
Hi Robert Domiano , It works and I end up with the below, but the main problem is I still have the 2+ popups showing up for every single polygon. Is there a way to have another expression or add to this expression a way to grab the first instance of Intersects and output only that one? The problem is that the expression is executed at the feature level. And when the user clicks con a feature, it will drill down to find all features it can find at that location. Unfortunately, there is no setting in the web map like you have in ArcGIS Pro (or ArcMap) to just return the top feature. Normally this type of data would be stored in a polygon layer with 0:n attachments configured for each polygon. A single polygon can have multiple attachments, avoiding the storage of multiple polygon at the same location. Although you don't have authority to change the data, you could derive a layer form this data that is following the correct storage (in case the data is static). If the data changes, since it is still being edited, I might be could to point out to the curator that this is most likely not the recommended way to manage the data. Continuing on this track is likely to produce more challenges on the road ahead.
... View more
09-29-2020
09:10 AM
|
0
|
0
|
3076
|
|
POST
|
Hi Robert Domiano , First of all, if there is any way to filter the layer and only show a single polygon, that would speed up performance. You can use the intersect of the $layer with the $feature to access the overlapping polygons, but depending if they are exactly the same or differ in size (and how much) you might have to apply a buffer with a negative value to avoid selecting neighboring polygons. The downside is that when you click a polygon, and it finds 11 polygons at that spot, it will do the intersect 11 times, once for each polygon the user clicked on. So, is it possible: yes. Will it perform and give a friendly experience: probably not so much. I would probably try and change the input polygon data and structure it differently, but it this depends on the dependencies you may have at a polygon level with other data or specific requirements to store it in this way. If you intersect the polygon regions with a layer that contains a single polygon with the entire area, you will end up intersecting every overlapping polygon and the ObjectID will help you identify the specific overlap case of the new polygon.
... View more
09-29-2020
06:51 AM
|
0
|
2
|
3076
|
|
POST
|
Hi Matthew Syvertson , What kind of link are you using to connect to the database? Maybe it is possible to correct the issue on the fly when linking to the other database. I agree with jborgion that if is common to use text for this type of identifier if you can't store it in a long field and you will not apply any numeric calculations on it.
... View more
09-28-2020
12:49 PM
|
0
|
1
|
10347
|
|
POST
|
Hi Nico Luus , It is a good thing that you checked the version matrix and you are right, the Contains function was introduced at Arcade version 1.7 which corresponds to Enterprise 10.7.1. Perhaps I would first start with validating if the first line is correct for accessing the points. Are they in the same $datastore as the current feature, is the name correct, etc? Did you use the interface to construct the Arcade expression or did you manually type in the name of the featurelayer? You could also try to use the Intersects function instead of the Contains function and see if the result is different: var GeopointFS = FeatureSetByName($datastore, "STAGING.LDR.Geo_Frame");
var fsint = Intersects(GeopointFS, $feature);
var cnt = Count(fsint);
return cnt; Notice that I am not returning null. If it does not find any points in the polygon it would be logical to state that there are 0 points, but maybe your requirements are different. Some other considerations: Do you have rules in place in case the points change? Do you also trigger the update of the polygons to recalculate the number of points?
... View more
09-28-2020
12:45 PM
|
2
|
2
|
2770
|
|
POST
|
Hi syvertson , The error is telling you that you can't write the value "14000002735000" from a double field (storable range -2.2E308 to 1.8E308) to a long field that will only be able to hold values in the range from -2,147,483,648 to 2,147,483,647.
... View more
09-28-2020
12:12 PM
|
1
|
1
|
10348
|
|
POST
|
Hi Matthew Syvertson , As far as I know the conversion of coordinate systems is not yet supported in Arcade expressions. You will find some examples on GeoNet of translating Web Mercator Auxiliary Sphere to WGS 1984 and vice verse. Those examples use a formula to get an approximate result, but it will not yield very exact results. What would be better is to to use a scheduled task and use the Calculate Geometry function to be able to get the results in another coordinate system: It would be nice to have support for projections between coordinate systems within Arcade (Attribute rules).
... View more
09-25-2020
12:14 PM
|
1
|
0
|
2154
|
|
POST
|
Hi bem08c , Thanks for posting back your solution. Hopefully we will be able to use attribute rules in ArcGIS Online soon, so you can trigger these calculations automatically when edits are posted and you won't have to create any scripts.
... View more
09-25-2020
06:06 AM
|
0
|
0
|
3377
|
|
POST
|
Hi Cody Biondi , I am not sure if this will be included in Collector. You may have heard that Collector and other field apps are being merged together in one easy to use application called ArcGIS Field Maps (currently in beta). There will be better support for Arcade in this app. It would be best to participate in the beta program (ArcGIS Field Maps ). This allows you to validate the functionality and contribute with suggestions for enhancements so that you (and others) will be able to enable those workflows in the new software.
... View more
09-25-2020
06:03 AM
|
1
|
1
|
3981
|
|
POST
|
Hi Nathan Bush , Sure, I can provide an example of how you can do this. However, it will be a long script in case you have to evaluate 100+ fields. Have a look at the expression below. The function "CorrectVal" is to correct the high values 99 and 100 to 0 to force them to the end of the list The function "compareVal" is a helper function to sort the values The function "TranslateVal" will translate the values 0 a 5 to the corresponding percentages Lines 33 to 40 is where the values of the attributes are read and written to an array containing objects with properties "FieldName" and "FieldVal". See note on line 1 on reading the attribute value. For testing I am using fixed values, and they should be corrected using the function "CorrectVal". The code will take the array of field names and field values and sort it in descending order using the value. Note that you will have to correct the values and replace texts by a value (for instance values 99 and 100 should be '1 to force them to the end of the list) The "maxrank" variable will define how many species should be returned in the ranking // Function to correct values higher than 5 to 0
Function CorrectVal(val) {
if (val > 5) {
return 0;
} else {
return val;
}
}
// Function to sort values from high to low
Function compareVal(a,b){
if (a["FieldVal"]<b["FieldVal"])
return 1;
if (a["FieldVal"]<b["FieldVal"])
return -1;
return 0;
}
// Translate values
Function TranslateVal(val) {
var dct = {"1": "<1%", "2": "1-10%", "3": "10-25%",
"4": "25-60%", "5": ">60%"};
val = Text(val);
if (HasKey(dct, val)) {
return dct[val];
} else {
return "Zero/NOT TARGETED/UNKNOWN";
}
}
// define the array of values to sort (with 100+ attributes, this list will be long!)
var fldsArray = [{"FieldName":"Alligator_Weed", "FieldVal": CorrectVal(1)}, // 10 should be replaced by $feature["Alligator_Weed"]
{"FieldName":"American_Lotis", "FieldVal": CorrectVal(5)},
{"FieldName":"Amur_Honeysuc", "FieldVal": CorrectVal(4)},
{"FieldName":"Asiatic_Tearthumb", "FieldVal": CorrectVal(2)},
{"FieldName":"Autumn_Olive", "FieldVal": CorrectVal(4)},
{"FieldName":"Barberry", "FieldVal": CorrectVal(3)},
{"FieldName":"Another_specie1", "FieldVal": CorrectVal(100)},
{"FieldName":"Another_specie2", "FieldVal": CorrectVal(99)}];
// sort the array
var test = Sort(fldsArray, compareVal);
// some initial settings
var maxrank = 5; // specify until which rank to show results
var rank = 0;
var cnt = 0;
var prevval = Null;
var result = "Ranking:";
// loop through sorted array
for (var i in test) {
cnt += 1;
var specie = Replace(test[i]["FieldName"], "_", " ");
var val = test[i]["FieldVal"];
if (val != prevval) {
rank = cnt;
}
if (rank <= maxrank) {
result += TextFormatting.NewLine + " - " + rank + ": " + specie + " (" + TranslateVal(val) + ")";
} else {
// exit loop
return result;
}
prevval = val;
}
return result; The result of this test expression is: Ranking:
- 1: American Lotis (>60%)
- 2: Amur Honeysuc (25-60%)
- 2: Autumn Olive (25-60%)
- 4: Barberry (10-25%)
- 5: Asiatic Tearthumb (1-10%) I hope this helps and if you need a hand you could share the data in a group and invite me ("xbakker.spx") to it to help create the expression.
... View more
09-24-2020
07:50 AM
|
1
|
2
|
3046
|
|
POST
|
Hi Nathan Bush , Thanks for the additional explanation and sharing the screen shot. This helps a lot. Using a dashboard to monitor the data collection process is a great resource. I can also imagine that you want to be able to symbolize the specie distribution since this may aid to recognize patterns of specie distribution. I do wonder if having a TOC with over 100 layers (one for each specie) is something that is "friendly" for the end user and I assume that this is something why you would like to have a custom widget that could enable a more user friendly way to navigate through the long list of species. Would it be possible to group the species at a higher level? Would this be acceptable for the end user? You can also use Arcade to determine the most predominant species in a grid and present this and other information in the pop-up.
... View more
09-23-2020
03:05 PM
|
0
|
4
|
3046
|
|
POST
|
Hi [email protected]_fws , In the scenario that you are using, you copy the layer in the web map, edit the expression (pointing to the correct attribute) and "ready". So, really that is only the beginning since as you probably have noticed, every time you edit the expression, the legend is regenerated and you would have to change colors and the order. The current order is first characters, than numbers and than special signs. If you could change the description in such a way that you don't have to change the order, that would help a little bit. I am curious though... are you planning to have 100+ layers in a single map? What will the end user experience look like?
... View more
09-22-2020
11:17 AM
|
1
|
6
|
3046
|
|
POST
|
Hi paul.sweeneyTLI , Have a look at the expression below and the comments in the code explaining some things to look at: // I would change the variable name portal, since it is a existing function
var myportal = Portal('https://www.arcgis.com');
// If the sql does not have any variables, don't make it more complex than needed
//var sql = "(surface_ty = '" + "1" + "')"+" AND "+"(status = '" + 1 +"')";
var sql = "(surface_ty = '1') AND (status = '1')";
// for testing cut the nested expressions into single lines
// limite the fields to the 1 that you need and don't extract the geometry
var fs = FeatureSetByPortalItem(myportal, 'xxxxxxxxxxx', 0 ,['Shape__Length'], False);
Console("fs:" + Count(fs));
// filter the featureset
var fsfiltered = Filter(fs, sql);
Console("fsfiltered:" + Count(fsfiltered));
// during intersection note that the first argument is the featureset and the second the feature!
var Ducts = Intersects(fsfiltered, $feature);
Console("Ducts:" + Count(Ducts));
// groupby is only used to group features by an attribute and return some statistic
// example: group ducts by material and return the total length by material
// doing a count on the results of a GroupBy will get you the number of different categories
// var groupSections = GroupBy(Ducts,['Shape__Length'],[{ name: 'outputStatName', expression: '1', statistic: 'COUNT' }]);
// count the overlapping lines
var cnt = Count(Ducts);
return cnt;
... View more
09-22-2020
06:27 AM
|
0
|
0
|
3375
|
|
POST
|
Hi Nathan Bush , You example refers to Alligator Weed, which is a plan species, so I guess that you are working with 100+ different type of species. Is that correct? Do these 100+ layers that you are working with only differ on the attribute used for creating the legend, or are the differences bigger? If they are bigger, some handwork will be involved to create the correct legends. If they are simular, you could probably use ArcGIS Pro (if you have access to it) and create a layer file that you apply after editing the arcade symbology expression.
... View more
09-22-2020
06:12 AM
|
0
|
8
|
3044
|
|
POST
|
Hi Nathan Bush , The order of the items van be changed directly in ArcGIS Online. Just drag and drop the items in the order you want to use. You are missing two categories based on the expression you shared: 25-60% and UNKNOWN. It is possible that in the data used to generate the legend, these two clases are not present. It may be present later on, if this data is dynamic and you are in the process of collecting the data. ArcGIS Online is a bit limited in adding multiples classes to the legend. To solve this, you can edit the actual json that defines the legend in the webmap using ArcGIS Online Assistant . Please make a copy first before editing the json of the web map.
... View more
09-21-2020
12:34 PM
|
0
|
10
|
3541
|
| 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 |
a week ago
|