Skip to content

@capgo/capacitor-native-map

Google Maps on Android, Apple MapKit on iOS, and Google Maps JS on web with one TypeScript API for markers, camera, and overlays.

@capgo/capacitor-native-map gives you one TypeScript API for native map performance on mobile and Google Maps JS on web. Create embedded maps in a DOM container, or use background mode (toBack) to draw the map behind a transparent WebView and build branded UI in HTML.

  • Lifecycle: create, destroy, show, hide, updateLayout, resize sync with Ionic scroll views.
  • Background mode: toBack compositing with multi-touch passthrough on transparent HTML.
  • Camera: setCamera, fitBounds, getMapBounds, min/max zoom, bearing, and tilt.
  • Markers: add, update, remove, drag, clustering, and event listeners.
  • Overlays: polygons, polylines, circles, and tile overlays (platform-dependent).
  • Events: map, marker, shape, cluster, and camera idle/move callbacks.
MethodDescription
createCreate a map (CreateMapArgs: id, config, optional element, apiKey, toBack, forceCreate).
destroyDestroy the map instance and release native resources.
show / hideShow or hide the native map without destroying it.
updateLayoutUpdate position and size in CSS pixels (especially in toBack mode).
enableTouch / disableTouchToggle whether the map receives gestures.
setCameraMove or animate the map camera.
getMapType / setMapTypeRead or set the map type (Normal, Hybrid, Satellite, Terrain, None).
fitBoundsFit the viewport to latitude and longitude bounds with optional padding.
getMapBoundsRead the current visible bounds.
setPaddingSet padding on the visible map region.
addMarker / addMarkersAdd one or many markers; returns marker ids.
removeMarker / removeMarkersRemove markers by id.
addPolygons / removePolygonsAdd or remove polygon overlays.
addPolylines / removePolylinesAdd or remove polylines.
addCircles / removeCirclesAdd or remove circles.
addTileOverlay / removeTileOverlayCustom tile layers (Android and web; partial support on iOS).
enableClustering / disableClusteringMarker clustering with optional minimum cluster size.
enableCurrentLocationShow the user location dot when permission allows.
enableIndoorMaps / enableTrafficLayerToggle indoor maps and traffic (platform-dependent).
setOnMapClickListenerListen for taps on the map surface.
setOnMarkerClickListenerListen for marker taps.
setOnCameraIdleListener / setOnCameraMoveStartedListenerCamera movement events.
setOnClusterClickListenerCluster tap events.
setOnPolygonClickListener / setOnCircleClickListener / setOnPolylineClickListenerShape tap events.
setOnMarkerDragStartListener / setOnMarkerDragListener / setOnMarkerDragEndListenerMarker drag events.

This API reference is generated from the plugin src/definitions.ts in the capacitor-native-map repository.

Keep going from @capgo/capacitor-native-map

Section titled “Keep going from @capgo/capacitor-native-map”

If you are using @capgo/capacitor-native-map in your Capacitor app, connect it with Using @capgo/capacitor-native-map for the SEO tutorial and related Capgo plugin docs.