Hi,
I am working on an web drone ground control station that uses ArcGIS Maps SDK for Javascript. The nature of the application makes it so I need to update multiple geometries and graphics several times per second (every time a telemetry message comes in, etc.). We mostly use FeatureLayer and GraphicsLayer for this, creating our graphics on the client side and updating them the same way.
When testing the performance of these update operations using firefox and chrome profilers, we have found that the best way to do this is to do something like this when updating a graphic already added to a GraphicsLayer:
const point = new Point({
spatialReference: SPATIAL_REFERENCE,
latitude: telemetry.latitude,
longitude: telemetry.longitude,
hasZ: true,
z: telemetry.relativeAltitude,
})
const symbolLayer = new ObjectSymbol3DLayer({
height: 1,
anchor: 'relative',
anchorPosition: {
x: 0,
y: 0,
z: -0.2,
},
resource: {
href: './drone3D.glb'
},
heading: telemetry.heading + 180,
tilt: telemetry.pitch,
roll: telemetry.roll,
})
droneModel.geometry = point
droneModel.symbol = new PointSymbol3D({
symbolLayers: [
symbolLayer
]
})
As you can see, we have to create a new Point geometry and a new PointSymbol3D with its corresponding ObjectSymbol3DLayer that loads the drone model resource.
This seems to be the most optimal way to do these kinds of updates, since the API as for now doesn't allow rerendering of the graphics when directly modifying the already existing geometries/symbols.
Even so, our rendering logic doesn't have the best performance when dealing with 50 updates/s, causing update delays that sometimes crash the tab. The solution we found for this particular case updating the drone model, is to cap the updates to 4 times per second.
Still, we see that when panning around the SceneView, when the map rerenders, our render updates sometimes stop, causing lag while the map is rerendering itself.
I guess my question is do you have some performance tip for this kind of application? ArcGIS works very well even when having thousands of features or graphics already plotted, the problem seems to be the fact we are updating a few graphics several times per second.
Thanks a lot
Thanks for the detailed description! There are various things that can influence the performance of your animation in 3D. Without seeing the code, I'll list some of the general aspects to check:
The use case you describe sounds very interesting and we would like to hear more about it, technically but also on a use case level, I'll get in touch via DM.