Last month, Esri gave us all a wonderful gift in the form of the ArcGIS API for JavaScript 4.18 release. Now that we’ve had a bit of time to play around with it, we thought we would explore some major highlights and a few important notes from the update.
ES Modules
The 4.x JavaScript API is all about enabling developers to craft modern solutions. Naturally, geodevs are going to want to use the API alongside modern tools and frameworks, like Angular or React. ES modules allow the 4.x API to be integrated with these third-party frameworks, and works in the current major browsers*. For steps on how to use ES modules, check out Esri’s guide on the topic or explore the sample apps on their GitHub.
Not using third-party frameworks and want to stick with loading in the API in a familiar way? No problem. You can continue using the AMD modules for the foreseeable future, according to this announcement on the 4.18 release.
*For an important note about supported major browsers and the JavaScript API v4.18 update, please see the Important Notes near the end of this article.
Cluster Querying
How data is represented is extremely important in GIS. It impacts how viewers understand and process the data. Having too many points can be overwhelming and confusing, obscuring important information. At the same time, summarizing data can lead to generalizations, and important details can be lost in a larger group. Enter cluster querying! Personally, cluster querying is one of my favorite things about this update.
With cluster querying, geodevs are able to marry the idea of clustering data to make the map more digestible with the need to keep important information accessible. Developers can query the aggregateIds property of a cluster to get all the ObjectIds of the represented features, and, thereby, their attributes.
As a result of cluster querying, maps can display the extent or convex hull of all the features represented in a cluster. Additionally, all of the features represented in a cluster can be displayed (perhaps for a more focused view upon selecting a particular region to dig into). Since the attributes for the features are still accessible, it is also easy to calculate and display statistics for the cluster.
To see the magic in action, check out this visual from Esri:
Moon and Mars Scene Support
While it might still be a little bit before there is a wide-spread need for processing data with spatial components on the Moon and Mars, it isn’t exactly far-off either. Always on top of things, Esri is already working on supporting extra-terrestrial geospatial needs. The latest update to the JavaScript API includes support for lunar and Martian coordinates (the moon is GCS 2000 and Mars has GCS 1979 and GCS 2000). These systems are also supported in SceneView with imagery, elevation, and even feature layer data about what has been mapped on each body. (One can’t help but wonder what Jules Verne would dream up after a virtual walk on Mars.)
While support for these coordinate systems is still experimental, it is very exciting. With advancements in astronomical research, as well as established coordinate systems for other extraterrestrial bodies, this functionality is something to keep an eye on for sure.
Custom Coordinate Systems
Ah, projections – some say a new one is created every day. However, just because someone has a projection doesn’t mean they can use it in a Scene – until now. As of the JavaScript API 4.18 release, Scenes can “load and visualize more datasets by supporting additional custom coordinate systems defined by a Well-Known Text (WKT) string” (Source). Since the WKT contains all the parameters that define a coordinate system, it can tell a Scene how to render it.
Don’t know how to get the WKT for your coordinate system? Esri already has the answer for you! Simply save a projection file (.prj) and open it in your text-editor of choice. Your WKT will be right there. (You can also see a number of them here or here, if you’re the curious type.)
Important Notes
- IE11 and Edge Legacy No Longer Supported
The JavaScript API is no longer supporting IE11 or Edge Legacy. Applications built with this, and later, versions of the API will not work in those browsers. For more information, please refer to the section of the release notes linked at the start of this bullet. - Internationalization
Esri is a global company, and it recognizes that many of the people who build solutions with their API need those solutions to work in a variety of languages. Supporting translations for text in custom widgets is easier with expansions to the intl class. For more information, please refer to the section of the release notes linked at the start of this bullet. - Scheduled Retirement of the 3.x JavaScript API
The 3.x version of the API is currently being updated with bugfixes only. Esri has stated they will retire it on August 1, 2022. They have more information about this in the link above.