JavaScript API 4.11 Sample Code

JavaScript API GeometryEngine - geodesic buffers


Note: Support for 3D on mobile devices may vary, view the system requirements for more information.

This sample uses GeometryEngine to create geodesic buffers around the pointer (mouse/touch) location as a user moves the pointer accross the view or when user clicks on the view.

GeometryEngine contains many of the same spatial tools as GeometryService, the primary difference being that GeometryEngine's functions are accessed on the client, bypassing the need to make additional server requests. This can significantly improve the performance of applications that use these functions.

How it works

The sample listens to pointer-move and click events both on SceneView and MapView. If the Spacebar is tapped, a user can click on or move the pointer around the SceneView or the MapView to create geodesic buffer around the pointer location.

view2d.on("pointer-move", function(event) {
  if (bufferEnabled) {
    createBuffer(event, view2d);

The user can tap the Spacebar to enable the default navigation behavior for the pointer-move event on MapView. The same can be done for SceneView.

Sample search results