Writing Arcade expression for overlapping variable taxing jurisdictions in the Popup tool, then sum the tax rate for TotalTaxRate.

535
3
04-19-2023 01:04 PM
BryantKosanovich
New Contributor

Hey gang! 

I've run into a roadblock in creating my own custom service for my agency, I've got ~500 taxing jurisdictions in total. They all can overlap, but don't have to. The main layers are State, County, Municipal (City), and Special Districts. This isn't the part I need help on, but providing a little background. Where I am stuck is configuring the Popup Tool to 1) list the applicable taxing jurisdictions that are present at any given point in the state (this part I was successful in with my code, see below. 

BryantKosanovich_3-1681934537200.png

Let me know if you need anymore info too please and thank you!!!

BryantKosanovich_0-1681934045473.png

Step 2 however, Total Tax Rate, I have no idea how to approach. Here's what I have now, but I have no idea if I'm even barking up the right tree at all. 

BryantKosanovich_1-1681934344458.png

 

var SumTax_Rate = Sum(
$feature.Tax_Rate,
'$feature.Jurisdiction_Name,$feature.Jurisdiction_Name'
)

return Text(SumTax_Rate, '$#,###.##')

 

The issue is, is the underlying data will always be changing whenever the user clicks on a different point on  the map. This is why I am trying to write the code to essentially grab whatever the results are from the first expression (or Step 1). 

The goal is to have it look something like this...

BryantKosanovich_2-1681934452933.png

 

 

0 Kudos
3 Replies
JohannesLindner
MVP Frequent Contributor

If I understand correctly, you want to just click anywhere in the map and show the sum of all tax rates at that coordinate?

That's currently not possible with Arcade, as there is no way to get the map coordinate you clicked on.

However, if you have features you can click on (say, address points or parcels), you can do it with an expression like this:

var districts = FeaturesetByName($map, "TaxRateLayer")
var i_districts = Intersects($feature, tax_districts)
return Sum(i_districts, "TaxRateField")

Have a great day!
Johannes
0 Kudos
BryantKosanovich
New Contributor
That’s interesting. So Arcade can gather all of the applicable, in this
case, tax rates, from the available features for a given location that a
user clicks, but it can’t sum them from the attribute data in those
features? That just seems like a weird shortcoming I guess. When a user
clicks on the map, it can accurately tell them there’s 3 jurisdictions with
rates 1%, 2%, and 3%, but it can’t provide the user with a total (sum) line
of 6%? It wouldn’t even really need to interact with the map at all at that
point though, Arcade has the data needed, it just needs to run a sum
operation from the results of that first click the user performed, right?

Thank you for responding too by the way, I appreciate the help. I don’t
want to sound ungrateful, I’m just perplexed given how robust Arcade
seemingly is I suppose. 🙂
0 Kudos
JohannesLindner
MVP Frequent Contributor

I mean, you can get the sum of all the jurisdiction taxes that intersect the currently selected jurisdiction. But that probably won't be the correct tax rate for the specific coordinate you clicked on.

As long as there is no way to get coordinates in Arcade, your best bet is probably to precompute the tax sums.


Have a great day!
Johannes
0 Kudos