Map View
A compose equivalent of the view-based MapView.
Since
200.4.0
Parameters
the ArcGISMap to be rendered by this composable MapView
Modifier to be applied to the composable MapView
lambda invoked when the viewpoint changes, passing a viewpoint type of ViewpointType.CenterAndScale
lambda invoked when the viewpoint changes, passing a viewpoint type of ViewpointType.BoundingGeometry
lambda invoked when the visible area of the composable MapView has changed
the ViewpointPersistence to specify how the viewpoint of the composable MapView is persisted across configuration changes.
graphics overlays used by this composable MapView
the LocationDisplay used by the composable MapView
the GeometryEditor used by the composable MapView to create and edit geometries by user interaction.
the MapViewProxy to associate with the composable MapView
the MapViewInteractionOptions used by this composable MapView
the ViewLabelProperties used by the composable MapView
the SelectionProperties used by the composable MapView
the inset values to control the active visible area, instructing the MapView to ignore parts that may be obstructed by overlaid UI elements and affecting the MapView's logical center, the reported visible area and the location display
represents the display of a coordinate system Grid on the composable MapView
the default color and context grid behind the map surface
the WrapAroundMode to specify whether continuous panning across the international date line is enabled
true if attribution bar is visible in the composable MapView, false otherwise
lambda invoked when the attribution text of the composable MapView has changed
lambda invoked when the attribution bar's position or size changes
the TimeExtent used by the composable MapView
lambda invoked when the composable MapView's TimeExtent is changed
lambda invoked when the navigation status of the composable MapView has changed
lambda invoked when the rotation of this composable MapView has changed
lambda invoked when the scale of this composable MapView has changed
lambda invoked when the Units per DIP of this composable MapView has changed
lambda invoked when the spatial reference of the composable MapView has changed
lambda invoked when the composable MapView's layer view state is changed
lambda invoked when the user starts and ends interacting with the composable MapView
lambda invoked when a user performs a rotation gesture on the composable MapView
lambda invoked when a user performs a pinch gesture on the composable MapView
lambda invoked when the user removes all their pointers from the composable MapView
lambda invoked when the user first presses on the composable MapView
lambda invoked when the user taps once on the composable MapView
lambda invoked the user double taps on the composable MapView
lambda invoked when a user holds a pointer on the composable MapView
lambda invoked when a user taps two pointers on the composable MapView
lambda invoked when a user drags a pointer or pointers across composable MapView
lambda invoked when the draw status of the composable MapView is changed
the content of the composable MapView
See also
Samples
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import com.arcgismaps.Color
import com.arcgismaps.data.ServiceFeatureTable
import com.arcgismaps.geometry.Point
import com.arcgismaps.geometry.SpatialReference
import com.arcgismaps.mapping.ArcGISMap
import com.arcgismaps.mapping.ArcGISScene
import com.arcgismaps.mapping.ArcGISTiledElevationSource
import com.arcgismaps.mapping.BasemapStyle
import com.arcgismaps.mapping.Surface
import com.arcgismaps.mapping.Viewpoint
import com.arcgismaps.mapping.layers.FeatureLayer
import com.arcgismaps.mapping.symbology.SimpleLineSymbol
import com.arcgismaps.mapping.symbology.SimpleLineSymbolStyle
import com.arcgismaps.mapping.symbology.SimpleRenderer
import com.arcgismaps.mapping.view.Camera
import com.arcgismaps.toolkit.geoviewcompose.MapView
import com.arcgismaps.toolkit.geoviewcompose.SceneView
fun main() {
//sampleStart
// Display a feature layer in a MapView using a service feature table
// create a map to display a feature layer
val map by remember {
mutableStateOf(ArcGISMap(BasemapStyle.ArcGISTopographic).apply {
initialViewpoint = Viewpoint( // USA viewpoint
center = Point(-11e6, 5e6, SpatialReference.webMercator()),
scale = 1e8
)
})
}
// create a service feature table (which will be used to create a feature layer)
val serviceFeatureTable = ServiceFeatureTable(
uri = "https://services.arcgis.com/jIL9msH9OI208GCb/arcgis/rest/services/USA_Daytime_Population_2016/FeatureServer/0"
)
// create the feature layer using the service feature table
val featureLayer: FeatureLayer = FeatureLayer.createWithFeatureTable(serviceFeatureTable)
// create symbol to show U.S. states with a black outline
val lineSymbol = SimpleLineSymbol(
style = SimpleLineSymbolStyle.Solid,
color = Color.black,
width = 1.0f
)
// set feature layer properties
featureLayer.apply {
// set renderer for the feature layer
renderer = SimpleRenderer(lineSymbol)
opacity = 0.8f
maxScale = 10000.0
}
// add the feature layer to the map's operational layers
map.operationalLayers.add(featureLayer)
// display the Composable MapView
MapView(
map,
modifier = Modifier.fillMaxSize(),
)
//sampleEnd
}