Inicialización
En esta sección se explica cómo inicializar y configurar correctamente MapConductor para distintos SDK de mapas.
Inicialización básica
Section titled “Inicialización básica”Dependencias Gradle
Section titled “Dependencias Gradle”Añade MapConductor a tu build.gradle.kts:
dependencies { implementation "com.mapconductor:mapconductor-bom:$version" implementation "com.mapconductor:core"
// Elige tus SDK de mapas implementation "com.mapconductor:for-googlemaps" implementation "com.mapconductor:for-mapbox" implementation "com.mapconductor:for-here" implementation "com.mapconductor:for-arcgis" implementation "com.mapconductor:for-maplibre"}Configuración de los SDK de mapas
Section titled “Configuración de los SDK de mapas”Cada SDK de mapas requiere una configuración específica y claves de API.
Google Maps
Section titled “Google Maps”@Composablefun GoogleMapsExample() { val mapViewState = rememberGoogleMapViewState()
GoogleMapView(state = mapViewState) { // Contenido del mapa }}Mapbox
Section titled “Mapbox”@Composablefun MapboxExample() { val mapViewState = rememberMapboxMapViewState()
MapboxMapView(state = mapViewState) { // Contenido del mapa }}HERE Maps
Section titled “HERE Maps”@Composablefun HereExample() { val mapViewState = rememberHereMapViewState()
HereMapView(state = mapViewState) { // Contenido del mapa }}ArcGIS
Section titled “ArcGIS”@Composablefun ArcGISExample() { val mapViewState = rememberArcGISMapViewState()
ArcGISMapView(state = mapViewState) { // Contenido del mapa }}MapLibre
Section titled “MapLibre”@Composablefun GoogleMapsExample() { val mapViewState = rememberMapLibreViewState()
MapLibreView(state = mapViewState) { // Contenido del mapa }}Inicialización
Section titled “Inicialización”@Composablefun CustomMapConfiguration() { val mapViewState = remember { GoogleMapViewStateImpl().apply { // Establecer la posición inicial de la cámara initCameraPosition = MapCameraPositionImpl( target = GeoPointImpl.fromLatLong(37.7749, -122.4194), zoom = 12f, bearing = 45f, tilt = 30f )
// Configurar el diseño/estilo del mapa mapDesignType = GoogleMapDesignType.SATELLITE } }
// Sustituye MapView por el proveedor de mapas que prefieras, como GoogleMapView o MapboxMapView GoogleMapView( state = mapViewState, onMapLoaded = { println("Map loaded and ready") } ) { // Contenido del mapa }}