The Jetpack Compose-enabled geoview-compose
library makes it easy to configure the MapView and SceneView composables from the ArcGIS Maps SDK for Kotlin using @
functions. These components allow you to manage the appearance, behavior, and event handling of your map and scene views declaratively using parameters or lambda functions.
- Appearance: Modify attributes like background grids, atmospheric effects, or selection properties.
- Behavior: Enable features such as location display or gesture handling.
- Events: Capture user interactions, such as taps, with callback lambdas.
GeoView Compose configurations
The Jetpack Compose-enabled geoview-compose
library is designed to simplify configuring maps and scenes. They fall into the following three primary roles:
Change appearance
These configurations update how your map or scene looks:
- Wraparound mode (
wrap
): Enables continuous panning across the international date line.Around Mode - Background grid (
background
): Configures gridlines behind your map.Grid - Atmosphere effect (
atmosphere
): Sets visual effects for sky simulation in a scene.Effect - Selection properties (
selection
): Changes color settings for selected features.Properties
MapView(
arcGISMap = map,
wrapAroundMode = WrapAroundMode.EnabledWhenSupported,
backgroundGrid = BackgroundGrid(color = Color.cyan),
selectionProperties = SelectionProperties(color = Color.red),
modifier = Modifier
.fillMaxSize()
.weight(1f)
.animateContentSize(),
)
Note:
- Use the Compose modifier parameter to allow you to decorate or augment the GeoView composables.
- See the Compose tutorial Style a feature layer to learn how to apply renderers and label definitions to a feature layer based on attribute values.
- See the sample app Show realistic light and shadows to learn how to show realistic lighting and shadows for a given time of day.
Control behavior
These configurations define how users interact with your GeoView:
- Enable location display with
location
.Display - Add geometry editing functionality via
geometry
.Editor - Customize interaction options using
map
.View Interaction Options
MapView(
arcGISMap = map,
locationDisplay = rememberLocationDisplay(),
geometryEditor = GeometryEditor(),
mapViewInteractionOptions = MapViewInteractionOptions(isPanEnabled = false)
)
Note:
- See the Compose tutorial Display device location to learn how to display the current device location on a map or scene.
- See the sample app Show device location using fused location data source to learn how to use the Fused Location Provider and Fused Orientation Provider to implement an ArcGIS Maps SDK Custom Location Data Source Location Provider.
- See the sample app Snap geometry edits to learn how to use the Geometry Editor to edit a geometry and align it to existing geometries on a map.
Capture events
Event-related configurations handle user interactions or changes in state:
- Detect gestures like single/double taps (
on
,Single Tap Confirmed on
).Double Tap - Capture navigation events such as rotation (
on
) or scaling (Rotate on
).Scale - Observe layer load status changes with callbacks like
on
.Layer View State Changed
These event-based configuration names often start with "on" to indicate trigger actions. For example, on
and on
.
MapView(
arcGISMap = map,
onSingleTapConfirmed = { tapEvent -> /* Handle tap */ },
onRotate = { rotationEvent -> /* Handle rotation */ },
onDrawStatusChanged = { drawStatus -> /* Respond to drawing updates */ }
)
Note:
- See the sample app Show callout to learn how to show a callout with the latitude and longitude of user-tapped points.
- See the sample app Show scale bar to learn how to add a scale bar to visually gauge distances on a map.
- See the sample app Display overview map to learn how to include an overview or inset map as an additional map view to show the wider context of the primary view.