Open source libraries

  • The Google Maps Platform offers numerous open-source libraries hosted on GitHub and npm to enhance the functionality of the Maps JavaScript API.

  • These libraries cater to various needs, including web components, API loading, TypeScript integration, React integration, marker and overlay extensions, testing, linting, and Node.js environments.

  • Developers can leverage libraries such as the Extended Component Library for streamlined UI development and the JS API Loader for dynamic API loading.

  • Dedicated libraries are available for specific frameworks like React and TypeScript, along with tools for testing, linting, and extending map functionalities with markers, clusters, and overlays.

  • Google Maps Platform provides Node.js libraries for server-side operations, such as making API calls and URL signing.

Many open source libraries are available to provide additional capabilities for Maps JavaScript API. These libraries are versioned on GitHub and published to npm.

Web Components

Use Maps JavaScript API Web Components to quickly add maps functionality to your websites. Web Components encapsulate boilerplate code, best practices, and responsive design, reducing complex map UIs into what is effectively a single HTML element.

Google Maps Platform Extended Component Library is a set of Web Components that helps developers build better maps faster, and with less effort.

npm i @googlemaps/extended-component-library

Loading the API

Modern web applications may benefit from using the following libraries to load the Maps JavaScript API.

Dynamically load the Maps JavaScript API with Promises.

npm i @googlemaps/js-api-loader

Using TypeScript

TypeScript users can get started with the following packages. Check out the using TypeScript guide for additional information.

TypeScript types for Maps JavaScript API

npm i -D @types/google.maps

TypeScript guards to narrow union types.

npm i -D @googlemaps/typescript-guards

Using React

React users can get started with the following packages.

Components and hooks to integrate the Maps JavaScript API into React applications.

npm i -D @vis.gl/react-google-maps

A wrapper component to declaratively load the Maps JavaScript API.

npm i @googlemaps/react-wrapper

Extending markers and overlays

The following libraries extend classes such as Marker and OverlayView.

Creates and manages per-zoom-level clusters for large amounts of markers.

npm i @googlemaps/markerclusterer

Adds and removes markers based upon map viewport changes.

npm i @googlemaps/markermanager

Add Open Geospatial Consortium (OGC) layers such as a Web Map Service (WMS) to a map.

npm i @googlemaps/ogc

Add custom HTML labels to markers.

npm i @googlemaps/markerwithlabel

Use WebGL and ThreeJS for high performance visualizations.

npm i @googlemaps/three

Use Deck.gl as a custom Google Maps overlay.

npm i @deck.gl/google-maps

Testing and linting

Use these libraries to ensure best practices and make testing easier for the Maps JavaScript API.

Use custom ESLint rules to lint your code.

npm i -D eslint-plugin-googlemaps

Mocks to use with the Jest testing library.

npm i -D @googlemaps/jest-mocks

Node.js Libraries

Node.js client library for making calls from cloud functions or serverside code.

npm i @googlemaps/google-maps-services-js

Encode and decode polylines in Node.js.

npm i @googlemaps/polyline-codec

Sign URLs in Node.js for additional security.

npm i @googlemaps/url-signature