New Features in the ArcGIS JavaScript API 4.2

by | Mar 20, 2017

This blog post covers new features in the ArcGIS JavaScript API 4.2, released as part of ArcGIS 10.5. Discussed below are new widgets, smart mapping in 2D and 3D, vector tiles in 3D, support for the Arcade scripting language and more.

Widgets

Widgets are reusable user-interface components that are key to providing a rich user experience. Apart from a set of ready-to-use widgets, it is now possible to create your own widgets with the API using a new widget framework. Three components are required for widget creation: TypeScript, JSX and the esri/core/Accessor class. Widgets are developed by using TypeScript, a superset of JavaScript that can be compiled to plain JavaScript. JSX is a JavaScript extension syntax that can be used inline with JavaScript and that came to popularity with the React framework. Because this widget framework uses a virtual JSX DOM library, it requires TypeScript in order to make it work within JavaScript. Finally, Accessor is one of the core features of 4.x and is the base for all classes, including widgets and is used to watch for changes in an application.

This new widget framework is for optional use and not intended to be a direct replacement for all Dijits. LayerList and Print are the first two widgets that have been implemented using the new widget framework: The LayerList widget provides a way to display a list of layers, and switching their visibility on and off, while The Print widget allows users to export the current mapview for printing or saving.

Support for Arcade

In the 4.2 release of the API, the Arcade scripting language is exclusively used for custom data-driven visualizations. Users now can pass an expression to renderers and visual variables. The expression will execute for each feature, generating a symbol based on the returned value. It is possible to save expressions to layer items and web maps in ArcGIS Online or Portal for ArcGIS. In future releases, users will have the ability to use it in other contexts, such as labeling.

Point Clouds

Point cloud data can be visualized using the new PointCloudLayer. This can be done in four different ways that correspond with point cloud visualization in ArcGIS Online: with RGB values, unique values, continuous color or stretched values, or class breaks.

Like what you’re reading? Subscribe now and receive the full version of our newsletter delivered to your inbox each week.

Elevation Query API

More precise elevation values (z-values) for points and polylines can be queried directly from an ElevationLayer with the queryElevation() method. The same can be done with the already available hitTest() method.

Smart Defaults for Location-based Visualizations

The API includes four objects new to the API for generating renderers with smart default symbols: location, color, size and univariateColorSize. This last one has been created specifically for visualizations using 3D symbols. Using the methods with one of these objects, you can perform data-driven and simple location-based visualizations. Three new widgets were added to easily explore spatial patterns in their data and update data-driven visualizations: ColorSlider, SizeSlider, and UnivariateColorSizeSlider.

Categories

Recent Posts

Eric van Rees
Eric van Rees is a freelance writer and editor. His specialty is GIS technology. He has more than eight years of proven expertise in editing, writing and interviewing as editor and editor-in-chief for the international geospatial publication GeoInformatics, as well as GIS Magazine and CAD Magazine, both published in Dutch. Currently, he writes about geospatial technology for various clients, publications and blogs.

Sign up for our weekly newsletter
to receive content like this in your email box.