ArcGIS Maps SDK for Kotlin offers a toolkit, ArcGIS Maps SDK for Kotlin Toolkit, that contains composable UI components to help simplify your Android development work. For information on how Android Jetpack Compose works, see Get started with Jetpack Compose.
The Geo
module has composable components to display maps and scenes. Most apps that use Android Jetpack Compose will need this module.
- GeoView-Compose - Contains the composable components
MapView
andSceneView
, which are wrappers for theMapView
andSceneView
classes in the Kotlin Maps SDK API.
The Toolkit contains other, special-purpose composable components:
- Augmented Reality - TableTopSceneView - Renders
ArcGIS
content anchored to a physical surface, as if it were a 3D-printed model.Scene - Augmented Reality - WorldScaleSceneView - Renders
ArcGIS
content overlaid on the camera feed to scale, so real-world features like streets and buildings line up with the scene content.Scene - Authenticator - Displays a user interface when network and ArcGIS authentication challenges occur.
- BasemapGallery - Provides a control for selecting basemaps.
- Callout - Draws a callout on the GeoView to display Composable content.
- Compass - Shows a compass direction when the map is rotated. Auto-hides when the map points north.
- FeatureForm - Enables users to edit field values of a feature using pre-configured forms.
- FloorFilter - Allows filtering of floor plan data in a geo view by a site, a facility in the site, or a floor in the facility.
- Legend - Displays a legend for a map or a scene.
- Popup - View field values of features in a layer using the Popup API.
- Scalebar - Displays current scale reference.
- UtilityNetworkTrace - Configure, run, and visualize UtilityNetworkTraces on a composable MapView.
The fastest way to get the toolkit into your app is to reference the compiled library (.aar file) from Jfrog, as described below. For instructions on using the toolkit from source code — for example, if you want to customize it — see Developer setup in the toolkit's repo.
Enhancements in 200.7.0
Authenticator
- Refactored the
DialogAuthenticator
and added UI enhancements.
Augmented Reality - World Scale
The WordScaleSceneView
composable function renders ArcGISScene
content overlaid on the camera feed to scale, aligning real-world features like streets and buildings with the scene content. It supports two WordScaleTrackingMode
s: World
, using the device's GPS, and Geospatial
, using the ARCore Geospatial API for high accuracy in areas with Google StreetView data. The composable provides parameters to configure and interact with the SceneView
, such as specifying an ArcGISScene
, graphics overlays, and lighting. It requires an ARCore-supported device with Google Play Services for AR installed and appropriate camera and location permissions. See the AR toolkit component for more details.
Basemap Gallery
The BasemapGallery
composable provides a grid display of available basemap styles, allowing users to browse and select basemaps for their map view. It accepts a lambda function to define actions when a gallery item is clicked. The basic usage involves creating BasemapGalleryItem
s from a BasemapStylesService
and displaying them in a BasemapGallery
below a MapView
. See the Basemap Gallery toolkit component for more details.
Feature Forms
- Updated validation behavior in the toolkit's
FeatureForm
for fields with a value expression. If aFieldFormElement
has a value expression as indicated by itshasValueExpression
property, validation errors are no longer shown. This is because theFeatureForm.validationErrors
now only includes validation errors for fields that are editable and visible. - Fixed an issue with list of
Attachment
s not being updated after adding or deleting them, if there is aGroupFormElement
in the form. See the FeatureForm toolkit component for more details.
Legend
The Legend
composable visually explains the symbols used on a map, showing the names of Layer
s, sublayers, and the LegendInfo
used in the map or scene. It dynamically updates to include only visible layers, adjusting as layers go in and out of scale range. Key features include filtering out layers hidden due to scale via the respectScaleRange
property, reversing the order of displayed layers with the reverseLayerOrder
property, and customizing the legend title using the title
See the Legend toolkit component for more details.
Scalebar
The Scalebar
composable toolkit component allows developers to show linear measurements on the map, aiding users in gauging the size of features or distances between them. This component is highly configurable, allowing users to choose between bar or line styles, customize colors, and automatically hide the scalebar after panning or zooming actions. It supports both metric and imperial units and dynamically adjusts its size and measurements based on the map's extent. The scalebar utilizes geodetic computations to ensure accuracy, making it a valuable addition for any mapping application. See the Scalebar toolkit component for more details.
Modular toolkit library
The toolkit has library modules that can be deployed independent of each other in an application. Note that an individual library module can contain one or more composable UI components.
Reference the library from Jfrog
-
If you haven't already, install and set up ArcGIS Maps SDK for Kotlin.
-
Ensure the Esri public Jfrog Maven repository is in your project's gradle file,
https
://esri.jfrog.io/artifactory/arcgis settings.gradle.kts (Project Settings)Use dark colors for code blocks dependencyResolutionManagement { repositories { ... maven { url = uri("https://esri.jfrog.io/artifactory/arcgis") } ... } }
-
From the Android view, open Gradle Scripts > build.gradle.kts (Module: app) and add a dependency for each component of the ArcGIS Maps SDK for Kotlin Toolkit that you will be using.
From the Project tool window, open Gradle Scripts > libs.versions.toml. In the
[versions]
section, verify you're using the correct version number for ArcGIS Maps SDK for Kotlin. And in the[libraries]
section, add the library declarations for the following:- the ArcGIS Maps SDK for Kotlin SDK.
- the ArcGIS Maps SDK for Kotlin Toolkit BOM.
- any Toolkit components needed. For example, to display a simple map or scene, you need only the
geoview-compose
component, which contains the composable functionsMapView
andSceneView
.
Gradle version catalogs are the standard Android approach to declaring dependency versions. They are preferred over specifying versions numbers in the
build.gradle.kts
or listing version numbers in aversion.gradle
. In recent releases of Android Studio, the New Project Wizard generatesbuild.gradle.kts
andgradle/libs.versions.toml
files that support this standard.Gradle version catalogs can also use BOM files to specify a single version number for all artifacts in the BOM. For more details, see
Using the BOM
in theREADME
of the ArcGIS Maps SDK for Kotlin Toolkit.Use dark colors for code blocks Copy // ArcGIS Maps for Kotlin - SDK dependency implementation(libs.arcgis.maps.kotlin) // Toolkit dependencies implementation(platform(libs.arcgis.maps.kotlin.toolkit.bom)) implementation(libs.arcgis.maps.kotlin.toolkit.geoview.compose) implementation(libs.arcgis.maps.kotlin.toolkit.authentication)
The highlights above indicate lines that we are adding to the default build.gradle.kts (
and gradle/libs.versions.toml
generated by the Android Studio New Project Wizard.
The first time you build a project, the Gradle build script will automatically download the ArcGIS Maps SDK for Kotlin and its resources to your development machine. Your Android Studio project will then access the Kotlin Maps SDK with no further action on your part.
Build from source
Although not required to do so, you can build the Toolkit components and micro-apps from the source code in the Toolkit repo. See the setup instructions for details.
Requirements
The following table shows version compatibility.
SDK Version | Toolkit Version |
---|---|
200.0.0 | none |
200.1.0 | none |
200.2.0 | 200.2.0 |
200.3.0 | 200.3.0 |
200.4.0 | 200.4.0 |
200.5.0 | 200.5.0 |
200.6.0 | 200.6.0 |
200.7.0 | 200.7.0 |
Issues
Find a bug or want to request a new feature enhancement? Please let us know by submitting an issue.