POST
|
A couple of things on this: 1. You can tell if a feature represents a cluster if the isAggregate property of the feature is `true`. Checking for `cluster_count` is pretty reliable for clusters, but unreliable if you want to check if a feature represents an aggregate from binning or clustering. 2. You cannot tell if a feature is an aggregate from a layer query (e.g. `layer.queryFeatures()`). This will always result in returning features from the underlying service, not from the client. At this point, clusters (and bins) are always generated client-side. Therefore, you cannot query them from a service. However, you may query them on the layerView. 3. You can query aggregates (i.e. clusters or bins) from the layer view using the queryAggregates() method. This will only query aggregates in the view, and not return any individual features. 4. If you query an aggregate that you want to drill into further (e.g. you query for a cluster with 5,000 features) you can use the resulting aggregate graphic of that query to query the features represented by (or contained within) that cluster. You can do this by calling the queryFeatures() method on the layer view and by setting the aggregateIds property to include the id of the aggregate feature you had just queried. 5. How can I determine whether a feature has been clustered or not? This depends on the origin of the feature. You can easily find out through hitTest if you are getting the feature from a click event. Simply check the isAggregate property. If you are getting the feature from a service query, then it's a bit more complicated. You would need to query all aggregates, iterate through each, then query all features included in each aggregate and check for a match. This is a pretty fast operation since these are all client-side queries. Here's an example of how to do this: https://codepen.io/kekenes/pen/MWMOrVP?editors=1000 In that sample I query a feature from the service, then highlight the cluster to which it belongs (even though it is not rendered in the view). const highlightCluster = async (layerView, id ) => {
if (highlightHandle) {
highlightHandle.remove();
highlightHandle = null;
}
const { features } = await layerView.queryAggregates();
features.forEach( async (f) => {
const aggId = f.getObjectId();
const q = layerView.createQuery();
q.aggregateIds = [ aggId ];
const { features } = await layerView.queryFeatures(q);
const result = features.find(f => f.getObjectId() === id);
if(result){
highlightHandle = layerView.highlight([aggId]);
}
});
}; Hopefully this helps.
... View more
|
1
|
1
|
40
|
POST
|
> Is there a way to generate the heat map using the data in the map view, what's in the current view extent? This is how this method works. It only takes into account what is in the view. > if I load the map being zoomed in with no data in the view, the heatmap is completely washed out. That's because there is no data in the view. You will only see anything meaningful if you zoom to the area where you have data and want to create a heatmap. > Or, can I set the zoom dynamically before loading the Heatmap, so the data is in the view? Yes. You can set this with the goTo method or by setting the view extent.
... View more
4 weeks ago
|
1
|
1
|
89
|
POST
|
I suggest contacting Esri support (support@esri.com ) with this issue. We're about to make another update, so it would be good to get this recorded in our our bug triage system to address it as soon as possible.
... View more
06-17-2024
09:24 AM
|
0
|
0
|
159
|
POST
|
This looks like it could be a bug. Could you reach out to Esri support and report to them? That way we can can a repro case on our end and an issue logged in our system that you can track the progress on.
... View more
05-16-2024
09:46 AM
|
1
|
0
|
138
|
POST
|
For performance issues and rendering bugs, I recommend you reach out to Esri Support (support@esri.com). They'll validate the issue you're seeing and create a bug report in our system so we can take a look at it. You'll also be able to track the planning and progress for the bug when reporting through that channel.
... View more
04-25-2024
08:56 AM
|
1
|
0
|
199
|
POST
|
Yikes. Do you mind logging an issue with support so we can get this into the system for fixing ASAP?
... View more
03-02-2024
01:02 PM
|
1
|
0
|
282
|
POST
|
You can do this by changing the selectedClusterBoundaryFeature symbol. view.popup.viewModel.selectedClusterBoundaryFeature.symbol = {
type: "simple-fill",
style: "none",
outline: null
}; Here's an app that demonstrates this: https://codepen.io/kekenes/pen/yLwWJoq?editors=100
... View more
02-21-2024
10:46 AM
|
1
|
0
|
339
|
POST
|
It's possibly a bug in the Enterprise map viewer. Is the error showing up in the Arcade editor where you're authoring the expression? If so, I'd log a bug with support so they can get that fixed. The execution context for the editor must have a matching spatial reference as well as the map. If you're copying and pasting into the playground of the online documentation, then you will definitely see that error as the spatial reference there is web mercator.
... View more
02-20-2024
02:53 PM
|
2
|
1
|
694
|
POST
|
You can test it out using https://js.arcgis.com/next/
... View more
02-05-2024
04:26 PM
|
0
|
0
|
367
|
POST
|
This should be fixed in the next update of the JS API (v4.29).
... View more
02-05-2024
04:25 PM
|
0
|
1
|
367
|
POST
|
You need to define aggregate fields for them to come through in $feature. That's what I meant by featureReduction.fields. This sample demonstrates how to do that. https://developers.arcgis.com/javascript/latest/sample-code/featurereduction-cluster-aggregate-fields/
... View more
02-02-2024
08:29 AM
|
0
|
0
|
532
|
POST
|
Yes you would need to set layer.featureReduction.renderer. to incorporate the three field values, you can either use a UniqueValueRenderer (if all the values are categorical) OR write an Arcade expression to combine them into a composite score. Something like the example below. Note that since this is a cluster renderer the attributes in $feature come from featureReduction.fields NOT layer.fields. So you'll need to account for that. const clusterRenderer = new SimpleRenderer({
symbol: {
type: "simple-marker",
size: 8,
outline: {
width: 0.5,
color: "rgba(255,255,255,0.5)"
}
},
visualVariables: [{
type: "size",
field: "cluster_count",
minSize: 12,
maxSize: 60,
minDataValue: 1,
maxDataValue: 1000
}, {
type: "color",
valueExpression: `
// $feature gives you access to feature attributes.
var status = Decode($feature.status,
"U", 10,
"C", 5,
0
);
var alert = Number($feature.alert);
var priority = Decode($feature.priority,
"High", 10,
"Medium", 5,
"Low", 3,
0
);
var score = (status + alert + priority) / 3;
return score;
`,
stops: [
{ value: 0, color: "white" },
{ value: 3, color: "beige" },
{ value: 5, color: "yellow" },
{ value: 7, color: "orange" },
{ value: 10, color: "red" }
]
}]
});
layer.featureReduction.renderer = clusterRenderer; mposite score or level. for example...
... View more
02-01-2024
10:36 AM
|
0
|
0
|
578
|
POST
|
I write about how you can do this in a few places. Basically, you can follow the pattern in this sample: https://developers.arcgis.com/javascript/latest/sample-code/visualization-update-data/ This is also described in this "Time styles" guide: https://developers.arcgis.com/javascript/latest/visualization/data-driven-styles/time/#attribute-animation Here are some blog posts that provide context and more examples: https://www.esri.com/arcgis-blog/products/js-api-arcgis/mapping/six-ways-to-visualize-change-over-time-in-web-maps/ https://www.esri.com/arcgis-blog/products/js-api-arcgis/mapping/animate-and-explore-covid-19-data-through-time/ https://www.esri.com/arcgis-blog/products/js-api-arcgis/mapping/mapping-large-datasets-on-the-web/ If you get it working, I'd love to see how it turns out.
... View more
12-13-2023
09:11 AM
|
0
|
0
|
369
|
POST
|
I wrote a blog article about how to do this a few years ago. The live samples are using older versions of the API, but the pattern for coloring the bins should be the same. https://www.esri.com/arcgis-blog/products/js-api-arcgis/mapping/make-your-histogram-legendary/
... View more
12-06-2023
02:52 PM
|
0
|
1
|
245
|
POST
|
fieldInfo.label doesn't take Arcade expressions. Arcade can only be defined in 2 places inside popups: expressionInfos, and ExpressionContent elements. To accomplish what you're attempting, you need an ExpressionContent element. This gives you full control over popup elements all within the scope of an Arcade expression. The expression itself needs to return the content type you want...in this case a chart. That chart's labels and values can be calculated using any Arcade function within the expression. Here's an example of the expression: var label = Text($feature.Field2);
var attributes = {
"Field 18 label": $feature.Field18
};
attributes[label] = $feature.Field25;
var fields = [];
for (var a in attributes){
Push(fields, a);
}
return {
type: "media",
attributes,
mediaInfos: [{
type: "piechart",
title: "Count by type",
value: {
fields
}
}]
}; And how you would reference it in your app: https://codepen.io/kekenes/pen/rNPqymw?editors=1000
... View more
11-30-2023
12:01 PM
|
1
|
1
|
333
|
Title | Kudos | Posted |
---|---|---|
1 | Tuesday | |
1 | 4 weeks ago | |
1 | 05-16-2024 09:46 AM | |
1 | 04-25-2024 08:56 AM | |
1 | 03-02-2024 01:02 PM |