Libraries

Stay organized with collections Save and categorize content based on your preferences.

To load the JavaScript code for the Maps JavaScript API, you include a bootstrap URL on your page, of the form https://maps.googleapis.com/maps/api/js. This bootstrap request loads all of the main JavaScript objects and symbols for use in the Maps JavaScript API. Some of the API features are also available in self-contained libraries which are not loaded unless you specifically request them. Breaking up supplemental components into libraries allows the main API to load (and parse) quickly. You only incur the additional overhead of loading and parsing libraries if you need them.

You can load additional libraries by specifying a libraries parameter in the bootstrap request, and supplying the name of the library or libraries. You can specify multiple libraries as a comma-separated list. You then access the libraries via the google.maps.libraryName namespace.

The following libraries are available:

  • drawing provides a graphical interface for users to draw polygons, rectangles, polylines, circles, and markers on the map. Consult the Drawing library documentation for more information.
  • geometry includes utility functions for calculating scalar geometric values (such as distance and area) on the surface of the earth. Consult the Geometry library documentation for more information.
  • journeySharing (available in the beta channel only) provides support for the Google Maps Platform Transportation and Logistics solutions.
  • localContext shows users key places of interest near a location that you specify. Consult the Local Context library documentation for more information.
  • marker lets you add highly customizable, performant Advanced Markers to your maps. Consult the Advanced Markers documentation for more information.
  • places enables your application to search for places such as establishments, geographic locations, or prominent points of interest, within a defined area. Consult the Places library documentation for more information.
  • visualization provides heatmaps for visual representation of data. Consult the Visualization library documentation for more information.

Preview: The following libraries are available in the beta channel (v=beta):

The following bootstrap request illustrates how to request the google.maps.geometry library of the Maps JavaScript API:

<script async
    src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&libraries=geometry&callback=initMap">
</script>

To request multiple libraries, separate them with a comma:

<script async
    src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&libraries=geometry,places&callback=initMap">
</script>