When creating the most simple layer using ArcGIS javascript api (4.26):
// Creating layer
var myLayer = new FeatureLayer({
url: "https://...",
renderer: {
type: "simple",
symbol: {
type: "simple-fill",
color: "yellow",
style: "solid",
outline: {
color: "red",
width: 1
}
}
}
});
// Adding it to the map
view.when(function () {
view.map.add(myLayer);
});
I am only returning back one feature (objectid). However, opening the network tab in chrome, reveals that it calls the server 3 times for same request. All 3 times it returns the same response with the same objectid. On the request the only parameter I noticed different on the 3 calls is the quantizationParameters sent as part of the request, specifically the xmin,ymin,xmax,ymax values were different on the 3 calls.
I would like to perform only one request to the server and eliminate the duplicate requests to the server.
My question is:
Attempts to fix the issue
I tried an old flag (quantize) from ArcGIS Javascript Api 3.x but it has no effect. It still sends the quantizationParameters to the server:
// Creating layer
var myLayer = new FeatureLayer({
url: "https://...",
quantize: "false",
...
Thank You
Thanks to Cabesuon's suggestion, I was able to get this working. I was not able to use a FeatureLayer, since using a FeatureLayer even when querying the objects locally would still hit the server when I displayed the FeatureLayer. It is possible that with additional time and knowledge, FeatureLayer might work. But my solution was to query the objects and then use a GraphicsLayer to display them. This worked since there was only one hit to the server during the query. Here is some of the code I used from this example: