Skip to main content
@capgo/capacitor-native-map Device APIs Open source

Native Map Capacitor plugin

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

Install

bun add @capgo/capacitor-native-map bunx cap sync
npm, pnpm or yarn
  • npm install @capgo/capacitor-native-map
  • pnpm add @capgo/capacitor-native-map
  • yarn add @capgo/capacitor-native-map

Guide

How to use Native Map in Capacitor

Using @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, shapes, clustering, and events.

Install

bun add @capgo/capacitor-native-map
bunx cap sync

What This Plugin Exposes

  • create: embedded map in a DOM element, or toBack: true for a map behind transparent HTML.
  • updateLayout: resize and reposition the native map (CSS pixels).
  • setCamera / fitBounds: camera and viewport control.
  • addMarker / addMarkers / removeMarker: markers with tap and drag listeners.
  • enableClustering: group dense marker sets.
  • enableCurrentLocation: user location dot when permission allows.
  • Overlays: polygons, polylines, circles, and tile layers (varies by platform).

Example Usage

Embedded map

import { NativeMap } from '@capgo/capacitor-native-map';

const map = await NativeMap.create({
  id: 'main-map',
  element: document.getElementById('map')!,
  apiKey: 'YOUR_GOOGLE_MAPS_API_KEY',
  config: {
    center: { lat: 37.7749, lng: -122.4194 },
    zoom: 12,
  },
});

map.setOnMapClickListener((e) => console.log(e.latitude, e.longitude));

// In a framework component, call `await map.destroy()` from your teardown/cleanup hook.

Background map with HTML UI

const map = await NativeMap.create({
  id: 'stores-map',
  toBack: true,
  apiKey: 'YOUR_GOOGLE_MAPS_API_KEY',
  config: {
    center: { lat: 40.7128, lng: -74.006 },
    zoom: 11,
    x: 0,
    y: 0,
    width: window.innerWidth,
    height: window.innerHeight,
  },
});

await map.updateLayout({
  x: 0,
  y: 0,
  width: window.innerWidth,
  height: window.innerHeight,
});

Wrap HUD sections with data-map-overlay (see getting started) so the overlay CSS enables taps; transparent areas pass gestures to the map.

Full Reference

FAQ

Native Map plugin FAQ

How do I install the Native Map plugin in a Capacitor app?

Run "bun add @capgo/capacitor-native-map" (or "npm install @capgo/capacitor-native-map"), then run "bunx cap sync" so the iOS and Android projects pick up the native code. Import it from "@capgo/capacitor-native-map" in your app code.

Does @capgo/capacitor-native-map work with React, Vue and Angular?

Yes. Native Map is a Capacitor package, so it works with any web framework that runs inside Capacitor, including Ionic, React, Vue, Angular, Svelte and plain JavaScript.

Which Capacitor version does @capgo/capacitor-native-map support?

Capgo plugins follow Capacitor's major version: use the plugin major version that matches your Capacitor major version (for example plugin v8 with Capacitor 8). The compatibility table in the GitHub README lists the maintained versions.

Is @capgo/capacitor-native-map free and open source?

Yes. The source code is public on GitHub at https://github.com/Cap-go/capacitor-native-map/ and the package is free to install from npm. Bug reports and pull requests are welcome.

Can I update code that uses Native Map without an App Store review?

Installing or upgrading the plugin changes native code, so it needs a new store build. After that, JavaScript, HTML and CSS changes that call the plugin can ship instantly with Capgo live updates.

Ship Native Map changes without waiting for app review

Once the plugin is in your store build, Capgo live updates push your JavaScript, HTML and CSS changes to users in minutes.

Start with Capgo