|
BLOG
|
Hi Michael Seybert , To give you an idea of the Arcade expression, have a look below: // TODO: change the layer name and field names
// access the feature and the zip code layer
var f = $feature;
var fszip = FeatureSetByName($map,"Name of the zip code layer in the map");
// create buffer
var size = $feature["TerritorySize"];
var bufferpol = Buffer($feature, size, 'miles');
// Intersect with zip codes
var fszipint = Intersects(fszip, bufferpol);
// loop through resulting zip codes and create resulting text
var result = "";
var cnt = Count(fszipint);
if (cnt > 0 ) {
// we have intersecting zip codes
result = cnt + " zip code(s) found:"
for (var zip in fszipint) {
// add zip code to the resulting text
var zipcode = zip["ZipCode"]; // change field name
result += TextFormatting.NewLine + " - " + zipcode;
}
} else {
// no intersecting zip codes
result = "No ZIP codes found";
}
return result;
... View more
09-15-2020
06:27 AM
|
0
|
0
|
4787
|
|
BLOG
|
Hi Michael Seybert , If you start from a geometry (it doesn't matter if it is a point, polyline or polygon) you can, in the Arcade expression, create a variable buffer around it (is the size stored in an attribute of how you you determine it?) and than intersect the buffer polygon with a zip code layer and create a list of intersecting zip codes to display in the pop-up. If you have the data in ArcGIS Online, and you are willing to share it with me, you can create a group, share the map and necessary data to that group and invite my user "xbakker.spx" to the group and I can help you create the expression.
... View more
09-14-2020
02:43 PM
|
0
|
0
|
4787
|
|
POST
|
Hi KhattabK , Unfortunately, it is not possible to access the exact location where the user clicked. It would be great to be able to do this. Currently for a pop-up you will have access (initially) to the feature geometry where the user clicked, but not the exact location. No problem for point data, but it will be for polylines and polygons.
... View more
09-14-2020
12:26 PM
|
2
|
1
|
8334
|
|
POST
|
Hi Jens_Dalsgaard , Unfortunately, I don't know where this information would be available. It may have been mentioned on one of the road maps, but then it will only state near-, mid- or long-term.
... View more
09-14-2020
06:39 AM
|
0
|
0
|
1797
|
|
POST
|
I can help you creating the expression, but I would need access to the data. You can create a group in AGOL, share the data or a portion of it and the map and invite muy AGOL user "xbakker.spx" to the group. That way I can see what is possible and provide you with a working Arcade expression.
... View more
09-11-2020
10:08 AM
|
0
|
4
|
3377
|
|
POST
|
Hi Paul Sweeney , Thanks for the additional explanation. It is possible to loop through the features, intersect the geometry and read out the surface and length to determine the total length per surface. If you would not intersect the geometry it wold be much easier using the GroupBy function as explained here (in Spanish, sorry): Incluir reportes estadísticas en las ventanas emergentes con Arcade usando GroupBy and in English in the blog post by Paul Barker: What’s New in Arcade 1.8
... View more
09-11-2020
10:06 AM
|
0
|
5
|
3377
|
|
POST
|
Hi Benjamin Mittler , That would require a field calculation that needs to be done every day to update the total amount of cases, since the symbology profile does not provide access to other data than the that held by the feature itself. So if you have multiple records for a county, you would need to access those records and calculate the sum. If doing a field calculation every day (or setting up a scheduled task in Pro to do this automatically) is not a problem, please post some more information on how your data is structures, to provide some more detailed information. The pop-up on the other hand does have access to other layer and features and can provide a sum of the cases for each county.
... View more
09-10-2020
04:20 PM
|
0
|
2
|
3381
|
|
POST
|
Hi Timothy Woodfield , Since you are using a Max function, you won't be able to get the maximum value and the related name of that record. This would require you to loop through the records and every time your date is higher than the previous maximum date, you would update the name of the maximum date found in previous records.
... View more
09-10-2020
04:10 PM
|
0
|
0
|
4258
|
|
POST
|
Hi Ekrem Canli , Thanks for testing this. To me this sound as something that should be reported to support. You should be able to use the DomainName function in the expression. One could do an additional test using the actual domain code of the feature and using the Domain function to see if you can extract the name from that domain, but I don't think that has a lot of potential. Please report the issue to support to have this fixed.
... View more
09-10-2020
06:20 AM
|
2
|
0
|
8752
|
|
POST
|
Hi Paul Sweeney , In your second code block I see that you are using a pretty long SQL query, but it does not contain any variables. Will it contain variable in the future? If not you could simplify it to: var sql = "(surface_ty IN ('2', '3', '4', '5', '6', '7') AND status IN ('1', '3'))"; And do you have additional spaces in front of ' 3', ' 4', ' 5', ' 6' and ' 7'? Because that is what your SQL is querying for. I don't see any problem in combing both expression into a single one and using the count from the first with the total length from the second to calculate trench length. It would be easier to see the data to understand what the limitations might be.
... View more
09-10-2020
06:05 AM
|
1
|
7
|
3377
|
|
POST
|
Hi Marvin Lopez , There is no function in Arcade that will get you the nearest feature in another layer. This does not mean that it is not possible. Let's assume you have two point layers, one holding the towns and the other the polling stations. When the user clicks on a town you will have access to the geometry. The town does not necessarily have to be a point, it could also be a polygon. If you have a huge amount of polling stations you will want to limit the search to a certain distance. This could be your search tolerance. The Arcade expression will take the town geometry (being a point or a polygon) and buffer it with the search tolerance. The resulting buffer polygon will be used to intersect the polling stations layer to obtain only the polling stations within the search distance. Next step would be to loop through each polling station and determine the distance and remember the minimum distance. In the resulting text that you can present to the end user you can include the name of the nearest polling station and the "as the crow flies" distance between the two. Remember, this will not be the actual distance someone will have to travel to get there. See the expression below how to do this: // specify a search distance using the map units
var searchtol = 10000;
// the town clicked on by the user
var town = $feature;
// buffer the town with search distance and specify the units
var searchbuffer = Buffer(town, searchtol, 'meters');
// access the poling stations layer (change according to your data)
var pollingstations = FeatureSetByName($map, 'SpecifyTheNameOfThePollingStationsLayerInTheMap', ['FieldnamePolingStation']);
// Find the nearpolling stations that are within the search distance
var nearstations = Intersects(pollingstations, searchbuffer);
// count polling stations in buffer
var cnt = Count(nearstations);
// check if there are any stations
if (cnt > 0) {
// there are polling stations
// initialize minimum distance, and polling station name
var min_dist = searchtol + 1;
var polstatname = null;
// loop through polling stations
for (var polstat in nearstations) {
// calculate distance between town and polling station
var dist = Distance(polstat, town, 'meters');
// if nearer than prevous nearest
if (dist < min_dist) {
// update nearest
min_dist = dist;
polstatname = polstat['FieldnamePolingStation'];
}
}
// return polling station name and distance to it
return polstatname + " (" + Round(min_dist, 1) + "m.)";
} else {
// there are NO polling stations (change units)
return "No polling stations within " + searchtol + " m.";
}
... View more
09-09-2020
05:54 PM
|
1
|
0
|
2085
|
|
POST
|
Hi Jens_Dalsgaard , Unfortunately, at this moment in Arcade it is not possible to call a service (execute a GP service or similar things) and process the response. I have heard that this is under consideration, but I don't know when it is available.
... View more
09-09-2020
04:59 PM
|
0
|
2
|
1797
|
|
POST
|
Hi KhattabK , Not entirely sure if this works, but could you try it? Function dist(x1, y1, x2, y2) {
return Sqrt(Pow(x2-x1, 2) + Pow(y2-y1, 2));
}
// get the geometry
var segment = Geometry($feature)["paths"][0];
// determine length halfway
var halflen = Length($feature) / 2;
// initialize vars
var xcrd = Null;
var ycrd = Null;
var cumlen = 0;
// loop through coordinate pairs in segment
for (var i in segment) {
if (i > 0) {
// second coordinate pair, start calculating distance
var xprev = segment[i-1]["x"];
var yprev = segment[i-1]["y"];
var xcurr = segment[i]["x"];
var ycurr = segment[i]["y"];
var len = dist(xprev, yprev, xcurr, ycurr);
var prevcum = cumlen;
cumlen += len;
// if past halfway on line
if (cumlen > halflen) {
// calculate midpoint
var restlen = halflen - prevcum;
var frac = restlen / len;
var xmid = (xcurr - xprev) * frac + xprev;
var ymid = (ycurr - yprev) * frac + yprev;
return "(" + Round(xmid, 2) + ", " + Round(ymid, 2) + ")";
}
} else {
// first coordinate pair
var xcrd = segment[i]["x"];
var ycrd = segment[i]["y"];
}
}
return "Error";
... View more
09-09-2020
04:57 PM
|
3
|
6
|
8343
|
|
POST
|
Hi Vladimír Holubec , In the future Attribute Rules should become available in ArcGIS Online and then you would be able to do this, with a trigger on the data. For now you can't do this in ArcGIS Online. Depending on what information you need to have access to in Dashboard, you could validate if the beta of Dashboard could be used for this. Maybe (I am not sure), there are options using webhooks which was released recently: Create a hosted feature service webhook
... View more
09-09-2020
02:58 PM
|
1
|
3
|
2057
|
|
POST
|
Hi Jordan Miller , Let's assume that the filter is executed correctly (which could be wrong depending on the format of the data). The main issue here is the fact that you return a featureset. Featuresets can be displayed when you test the expression in the expression editor, but will not be shown up in the pop-up. You will need to go through each feature in the featureset and extract the information you need and create a text that you want to show in the pop-up. Some examples where this is explained in detail are: Using FeatureSetBy functions in Arcade to drill-down to other layers and tables https://community.esri.com/docs/DOC-13665-create-a-mailto-link-with-arcade
... View more
09-09-2020
02:52 PM
|
1
|
0
|
1270
|
| 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
|