🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

aurelia2-google-maps

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aurelia2-google-maps

A port of the Aurelia Maps plugin to v2

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
30
275%
Maintainers
1
Weekly downloads
 
Created
Source

aurelia2-google-maps

A plugin for working with Google Maps in Aurelia 2 applications.

Installation

npm install aurelia2-google-maps

If you are using TypeScript, add the Google Maps types:

npm install -D @types/google.maps

Configure your app

Inside of main.ts/main.js register the plugin:

import { GoogleMapsConfiguration } from "aurelia2-google-maps";

Aurelia.register(
  GoogleMapsConfiguration.configure({
    apiKey: "YOUR_API_KEY",
    libraries: ["places", "geometry", "drawing"],
    options: {
      backgroundColor: "#495061",
    },
  })
);

If you prefer a callback style:

import { GoogleMapsConfiguration } from "aurelia2-google-maps";

Aurelia.register(
  GoogleMapsConfiguration.customize((config) => {
    config.options({
      apiKey: "YOUR_API_KEY",
      language: "en",
      region: "US",
    });
  })
);

Loader options

You can pass any loader options through loaderOptions (for example mapIds, authReferrerPolicy, channel, or solutionChannel). Use libraries or apiLibraries to load extra Google Maps libraries.

Using the map component

<google-map
  latitude.bind="lat"
  longitude.bind="lng"
  zoom.bind="zoom"
  markers.bind="markers"
  polygons.bind="polygons"
  auto-update-bounds.bind="true"
  on-event.bind="handleMapEvent">
</google-map>

onEvent receives a typed event union. You can switch on event.type to handle map, marker, polygon, and info window events.

Places, Geocoder, Autocomplete

import { GoogleMaps } from "aurelia2-google-maps";

export class MyViewModel {
  map!: GoogleMaps;

  async attached() {
    const geocoder = await this.map.getGeocoder();
    const places = await this.map.getPlacesService();
    const autocomplete = await this.map.createAutocomplete(
      this.addressInput,
      { fields: ["place_id", "geometry", "name"] }
    );
  }
}

Marker clustering

Marker clustering uses @googlemaps/markerclusterer and accepts the modern MarkerClustererOptions under markerCluster.options.

GoogleMapsConfiguration.configure({
  markerCluster: {
    enable: true,
    options: {
      onClusterClick: (event, cluster, map) => {
        map.fitBounds(cluster.bounds);
      }
    }
  }
});

Note: the legacy markerCluster.src, imagePath, and imageExtension options are no longer used.

FAQs

Package last updated on 01 Jan 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts