I am using ArcGIS Javascript 4.17
I have a feature layer like this
var testlayer = new FeatureLayer({
url: "{Some url here}",
outFields: ["*"], // Return all fields so it can be queried client-side
title: "my test layer"
});
This is a sample output:
Is it possible to change the color of each section (the icons inside red circle) to a different color on the fly with just one layer?
So for example this is my desired output color per section (one section is colored blue, one section is colored black, one section is colored green). Currently what I can think of is clone the feature layer then query then pass the data and create multiple feature layers per section with my desired color. But is there any other way to do this within just a single layer?
If the data has unique field values for the areas you want to color differently, you can use a unique values renderer.
A link for your convenience 😀
Hi, you could use Arcade to do this if you're sketching geometries. Here's a codepen showing how to encode the sketched geometries into an Arcade expression. You then use a UniqueValueRenderer to style the intersecting features how you want. https://codepen.io/kekenes/pen/GRjVvJL