2

I am attempting to create a dynamic webmap to display varying values across a grid of polygons. Within each grid cell there are multiple overlapping polygons (grid cells) each with a unique value. I would like aggregate these values to give a total value for each grid cell which relates to the sum of each of the overlapping values. These would then be displayed using a quantitative color gradient.

I would dissolve this layer and sum each overlapping polygon's value and display it as a flat single feature per cell, however I have also added the ability for users to filter specific values out relating to a descriptive attribute within the table.

The approach I have tried was to

•Create a flat empty grid with single cells.

•Took the centroid of the each overlapping polygon.

This left me with a point layer of overlapping features (value) and a polygon layer of a grid with only an ID code.

Within the WebMap builder I have set the symbology of the grid using the Arcade expression:

var centroid = FeatureSetByName($map,"centroid_values")
IIf(Contains($feature, centroid), Sum(value), 0)

This aims to sum the "value" of each point contained within the single empty grid cell and display it. This would mean if the user was to filter the points based off an attribute the symbology would be dynamic.

However, I am running into the error:

Parse Error:featuresetbyname is not available

Is it possible to incorporate a separate featureset from the map into the symbology expression for a layer?

The featureset functions appear to be greyed out an labelled 'Not Available" within the function list.

Are there any other approaches to overcome the problem outlined above?

I have experimented with joins however the number of records means it is extremely slow to process and is not dynamic when the user applies filters.

1

Instead of the IIf/Contains try using Intersects(). Its hard to know for sure without having the data to test on but give something like this a try. I modified this from one of the examples here.

var centroids = FeatureSetByName($map,"centroid_values")
var centroids_int = Intersects(centroids, $feature); //gets centroids contained by grid cell
var cnt = Count(centroids_int); //counts centroids optional
var intCnt = "There are " + cnt + " intersecting polygons:"; //optional
var vSum = 0 //initialize sum
for (var centrd in centroids_int) {
    vSum = vSum + centrd.fieldname //fieldname is the name of the field you want to sum from the centroids layer
}

return intCnt + " " + vSum;

enter image description here enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.