Select to view content in your preferred language

Arcade - in popup get points intersecting polygon when clicking on another point feature

37
1
Jump to solution
7 hours ago
Labels (1)
clt_cabq
Frequent Contributor

I have a layer of points (call it points of interest), I would like to click on one, and obtain in a popup all the addresses (from address points) that fall within the parcel that the original point is within. I thought the approach below would work, but the the line 8 below fails, telling me there is an invalid parameter. There will be other steps after this that actually return the list of addresses for use in the popup, but can't implement that until i actually have a set to work with. This seems straightforward in my head (click on poi, get a parcel, get the address points that fall inside the parcel) but I'm obviously missing something. Thoughts?

// gets addresses that belong to a single parcel
var fs_parcels = FeatureSetByName($map, "parcel layer"['UPC','OWNER','OWNADD','SITUSADD'])
var targ_parcel = Intersects(fs_parcels, $feature) //target parcel from clicking on point of interest
console("returns " + Count(targ_parcel)+ " parcels")//gives me a count of 1, as expected
var fs_addr_pts = FeatureSetByName($map, "addr_points",['GeoAddress'])//creates feature set of address points in map
console("returns " + Count(fs_addr_pts))//returns 207,000 records found in featureset
//the next setp fails and doesn't return any features
var parcel_addrs = Intersects(fs_addr_pts, targ_parcel)
Console("returns " + count(parcel_addrs) + " addresses")

 

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

The Intersects function takes a FeatureSet and a Feature. Even though targ_parcel contains only one Feature, it's still considered a FeatureSet. What you have to do is get the First item of that FeatureSet (line 3) to use in the Intersects function.

// gets addresses that belong to a single parcel
var fs_parcels = FeatureSetByName($map, "parcel layer", ['UPC','OWNER','OWNADD','SITUSADD'])
var targ_parcel = First(Intersects(fs_parcels, $feature)) //target parcel from clicking on point of interest
//console("returns " + Count(targ_parcel)+ " parcels")//gives me a count of 1, as expected
var fs_addr_pts = FeatureSetByName($map, "addr_points",['GeoAddress'])//creates feature set of address points in map
console("returns " + Count(fs_addr_pts))//returns 207,000 records found in featureset
//the next setp fails and doesn't return any features
var parcel_addrs = Intersects(fs_addr_pts, targ_parcel)
Console("returns " + count(parcel_addrs) + " addresses")

 

 

View solution in original post

0 Kudos
1 Reply
KenBuja
MVP Esteemed Contributor

The Intersects function takes a FeatureSet and a Feature. Even though targ_parcel contains only one Feature, it's still considered a FeatureSet. What you have to do is get the First item of that FeatureSet (line 3) to use in the Intersects function.

// gets addresses that belong to a single parcel
var fs_parcels = FeatureSetByName($map, "parcel layer", ['UPC','OWNER','OWNADD','SITUSADD'])
var targ_parcel = First(Intersects(fs_parcels, $feature)) //target parcel from clicking on point of interest
//console("returns " + Count(targ_parcel)+ " parcels")//gives me a count of 1, as expected
var fs_addr_pts = FeatureSetByName($map, "addr_points",['GeoAddress'])//creates feature set of address points in map
console("returns " + Count(fs_addr_pts))//returns 207,000 records found in featureset
//the next setp fails and doesn't return any features
var parcel_addrs = Intersects(fs_addr_pts, targ_parcel)
Console("returns " + count(parcel_addrs) + " addresses")

 

 

0 Kudos