Return values from ArcGIS Arcade intersect and search the returned values in a table

1609
5
Jump to solution
06-14-2021 02:21 AM
by Anonymous User
Not applicable

Hello:

我需要帮助创建一个ArcGIS拱廊弹出exprsion that will intersect and return all address points found in any given parcel in my parcel layer. I would then like to see if those intersected address points are also in a separate flat table also in my web map. I would like to display the values for a certain field in that table if so (the Path field). I wanted to create the new expression by working off my existing expression that already returns the intersected values using the FullAddress field. The help I need is determining if those intersected values in the FullAddress field in the address point layer are also in the the FullAddress field in the table and then display the value in the Path field if so. My table is in the map and called PDF Archive:https://lacounty.maps.arcgis.com/apps/webappviewer/index.html?id=4cf18bf143c049ef84a173672e089e48

The existing expression is below. You can click on any parcel in the web map to see how it works.

var addresspoints =相交(美元)特性,特性etByName($map,"Addresses (GIS)", ["FullAddress"]) ); var cnt = Count(addresspoints); var counter = (cnt-(cnt - 1)) var address_info = "";// validate if there are any intersected records and handle accordingly if (cnt > 0) { // there is at least 1 intersected record, create address info address_info = cnt + " Address(es):"; // loop through intersected records for (var address in addresspoints) { // create text using name and description var address_text = (counter++) + ". " + address.FullAddress; // add the text for this address to the address info address_info += TextFormatting.NewLine + address_text; }} else { // no intersected records address_info = "No addresses found for this parcel";} return address_info;

Any help would be greatly appreciated.

0Kudos
1 Solution

Accepted Solutions
JohannesLindner
MVP Regular Contributor

Something like this?

var addresspoints =相交(美元)特性,特性etByName($map,"Addresses (GIS)", ["FullAddress"]) ); var cnt = Count(addresspoints); // exit early, this removes the need for the else block var counter = (cnt-(cnt - 1)) if(cnt == 0) { return "No addresses found for this parcel" } // load the pdf table. you need at least the Path field and the field linking // this table to your address points. I used FullAddress here, if it's // some other field, you will have to include that in addresspoints, too. var pdf_table = FeatureSetByName($map, "PDF", ["FullAddress", "Path"]) address_info = cnt + " Address(es):"; for (var address in addresspoints) { // filter your pdf table var key = address.FullAddress // or use your key field here var pdf_row = First(Filter(pdf_table, "FullAddress = @key")) // or use your key field here // if a pdf was found, display the path after the full address var pdf_path = "" if(!(pdf_row == null || IsEmpty(pdf_row))) { pdf_path = "; PDF: " + pdf_row.Path } var address_text = (counter++) + ". " + address.FullAddress + pdf_path address_info += TextFormatting.NewLine + address_text; } return address_info;

Have a great day!
Johannes

View solution in original post

5 Replies
JohannesLindner
MVP Regular Contributor

Something like this?

var addresspoints =相交(美元)特性,特性etByName($map,"Addresses (GIS)", ["FullAddress"]) ); var cnt = Count(addresspoints); // exit early, this removes the need for the else block var counter = (cnt-(cnt - 1)) if(cnt == 0) { return "No addresses found for this parcel" } // load the pdf table. you need at least the Path field and the field linking // this table to your address points. I used FullAddress here, if it's // some other field, you will have to include that in addresspoints, too. var pdf_table = FeatureSetByName($map, "PDF", ["FullAddress", "Path"]) address_info = cnt + " Address(es):"; for (var address in addresspoints) { // filter your pdf table var key = address.FullAddress // or use your key field here var pdf_row = First(Filter(pdf_table, "FullAddress = @key")) // or use your key field here // if a pdf was found, display the path after the full address var pdf_path = "" if(!(pdf_row == null || IsEmpty(pdf_row))) { pdf_path = "; PDF: " + pdf_row.Path } var address_text = (counter++) + ". " + address.FullAddress + pdf_path address_info += TextFormatting.NewLine + address_text; } return address_info;

Have a great day!
Johannes
by Anonymous User
Not applicable

Hi Johannes:

This looks good although is there another way to fetch the values in the table other than a relate? Like doing a search or find? The relate takes longer and I did not think it would be necessary since the specific values to search for in the table are being are already provided using the intersect. I did find a "find function" in the arcade documentation although was not sure how it could be implemented or if it even could be used in this way. Any insight you have would be great.

BrandonPrice2_0-1623909476019.png

0Kudos
JohannesLindner
MVP Regular Contributor

If I understood your problem correctly, you have 3 tables / feature classes: the parcels, the address points and a standalone table containing the pdf paths. If that is correct, then the code I posted is the way to do it.

If you can get the pdf paths into the address points (join), it would be easier:

var addresspoints =相交(美元)特性,特性etByName($map,"Addresses (GIS)", ["FullAddress", "PdfPath"]) ); var cnt = Count(addresspoints); var counter = (cnt-(cnt - 1)) if(cnt == 0) { return "No addresses found for this parcel" } address_info = cnt + " Address(es):"; for (var address in addresspoints) { var pdf_path = "" if(!IsEmpty(address.PdfPath)) { pdf_path = "; PDF: " + address.PdfPath } var address_text = (counter++) + ". " + address.FullAddress + pdf_path address_info += TextFormatting.NewLine + address_text; } return address_info;

Find is for finding sub-strings in strings. It won't help you with feature sets.


Have a great day!
Johannes
0Kudos
by Anonymous User
Not applicable

Hi Johannes:

Would a relate work instead of a join? I have the addresses and pdf table related together in a published service.

0Kudos
JohannesLindner
MVP Regular Contributor

To get the pdf path without another search, it will have to be in the same table, so join.

If AddressPoints and PDF are related by a relationship class, you could try FeatureSetByRelationshipName, maybe it's faster:

address_info = cnt + " Address(es):"; for (var address in addresspoints) { // filter your pdf table var pdf_row = First(FeatureSetByRelationshipName(address, "RelationshipName", ["Path"]) // if a pdf was found, display the path after the full address var pdf_path = "" if(!(pdf_row == null || IsEmpty(pdf_row))) { pdf_path = "; PDF: " + pdf_row.Path } var address_text = (counter++) + ". " + address.FullAddress + pdf_path address_info += TextFormatting.NewLine + address_text; }


Have a great day!
Johannes
0Kudos