# googlemaps

> DEPRECATED: This package is no longer maintained. Please use @googlemaps/google-maps-services-js instead.

Latest version **1.13.0** (published 2026-08-10) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install googlemaps
pnpm add googlemaps
yarn add googlemaps
bun add googlemaps
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.13.0 |
| Published | 2026-08-10 |
| First published | 2011-05-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/googlemaps) |
| Module format | CommonJS |
| Node | >=18 |
| Dependencies | 3 |
| Unpacked size | 67.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 557 |
| Author | Colin Kennedy |
| Maintainers | moshen, fabmos |
| Keywords | map, geo, google, api, googlemaps, google maps, google-maps, node google maps, deprecated, google-maps-services |

## Links

- npm: https://www.npmjs.com/package/googlemaps
- Repository: https://github.com/moshen/node-googlemaps
- Homepage: https://github.com/moshen/node-googlemaps#readme
- Issues: https://github.com/moshen/node-googlemaps/issues
- npm.io page: https://npm.io/package/googlemaps

## Dependencies (3)

- [undici](https://npm.io/package/undici.md) ^6.0.0
- [waitress](https://npm.io/package/waitress.md) >=0.0.2
- [check-types](https://npm.io/package/check-types.md) ~1.3.2

## Recent versions

- 1.13.0 (latest) — 2026-08-10
- 1.12.0 — 2016-12-20
- 1.11.1 — 2016-07-19
- 1.11.0 — 2016-07-18
- 1.10.0 — 2016-07-18
- 1.9.0 — 2016-07-18
- 1.8.0 — 2016-07-18
- 1.7.0 — 2016-07-18
- 1.6.0 — 2016-05-13
- 1.5.0 — 2016-05-09
- 1.4.0 — 2016-03-01
- 1.3.0 — 2016-02-24
- 1.2.0 — 2016-02-04
- 1.1.3 — 2016-01-19
- 1.1.0 — 2016-01-19
- … 24 more at https://npm.io/package/googlemaps/versions

## README

[![CI](https://github.com/moshen/node-googlemaps/actions/workflows/ci.yml/badge.svg)](https://github.com/moshen/node-googlemaps/actions/workflows/ci.yml)

# Google Maps API for Node.js

> **DEPRECATED:** This package is no longer maintained. Please use Google's official Node.js client library [`@googlemaps/google-maps-services-js`](https://github.com/googlemaps/google-maps-services-js) instead.

This library implements the following Google Maps APIs, and can be also used by Google Maps for Work users.

* [Maps API Web Services](https://developers.google.com/maps/documentation/webservices/)
* [Google Places API](https://developers.google.com/places/)
* [Google Maps Image API](https://developers.google.com/maps/documentation/imageapis/)

This library is **NOT COMPATIBLE** with tags < `1.0.0`

If you want to migrate from a version older than `1.0.0` check the [WIKI](https://github.com/moshen/node-googlemaps/wiki/Migrate-from-v0.1.20-to-v1.0.x) for instructions.

### Installation

```
npm install googlemaps
```

### What does it cover
[Maps API Web Services](https://developers.google.com/maps/documentation/webservices/):

* [Directions](https://developers.google.com/maps/documentation/directions/)
* [Distance matrix](https://developers.google.com/maps/documentation/distancematrix/)
* [Elevation](https://developers.google.com/maps/documentation/elevation/) - TO BE IMPROVED
* [Geocoding and reverse geocoding](https://developers.google.com/maps/documentation/geocoding)
* [Time zone](https://developers.google.com/maps/documentation/timezone)

[Google Places API](https://developers.google.com/places/) - NOT COMPLETED

* [Place search](https://developers.google.com/places/documentation/search)
* [Place details](https://developers.google.com/places/documentation/details)
* [Place autocomplete](https://developers.google.com/places/web-service/autocomplete)
* [Place text search](https://developers.google.com/places/web-service/search#TextSearchRequests)

[Google Maps Image API](https://developers.google.com/maps/documentation/imageapis/)

* [Static maps](https://developers.google.com/maps/documentation/staticmaps/)
* [Street view](https://developers.google.com/maps/documentation/streetview/) - TO BE IMPROVED


### Usage

```javascript
var publicConfig = {
  key: '<YOUR-KEY>',
  stagger_time:       1000, // for elevationPath
  encode_polylines:   false,
  secure:             true, // use https
  proxy:              'http://127.0.0.1:9999' // optional, set a proxy for HTTP requests
};
var gmAPI = new GoogleMapsAPI(publicConfig);

// or in case you are using Google Maps for Work
var enterpriseConfig = {
  google_client_id:   '<YOUR-CLIENT-ID>', // to use Google Maps for Work
  google_private_key: '<YOUR-PRIVATE-KEY>', // to use Google Maps for Work
  google_channel:     '<YOUR-CHANNEL>' // to use Google Maps for Work application usage tracking
  stagger_time:       1000, // for elevationPath
  encode_polylines:   false,
  secure:             true, // use https
  proxy:              'http://127.0.0.1:9999' // optional, set a proxy for HTTP requests
};
var gmAPI = new GoogleMapsAPI(enterpriseConfig);

// geocode API
var geocodeParams = {
  "address":    "121, Curtain Road, EC2A 3AD, London UK",
  "components": "country:GB",
  "bounds":     "55,-1|54,1",
  "language":   "en",
  "region":     "uk"
};

gmAPI.geocode(geocodeParams, function(err, result){
  console.log(result);
});

// reverse geocode API
var reverseGeocodeParams = {
  "latlng":        "51.1245,-0.0523",
  "result_type":   "postal_code",
  "language":      "en",
  "location_type": "APPROXIMATE"
};

gmAPI.reverseGeocode(reverseGeocodeParams, function(err, result){
  console.log(result);
});
```

Check out the [unit tests](./tree/new-major-version/test/unit/) for more APIs examples.

### Optional configuration

The following config keys control behavior that was added as bug fixes but
could break existing callers. Each defaults to the old (pre-fix) behavior
so existing code keeps working unless you opt in.

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| `static_map_binary` | boolean | `false` | When `true`, `staticMap` returns image data as a `Buffer` instead of a string. Use this if you save the image to a file (the old string output produced unusable files). |
| `static_map_warnings` | boolean | `false` | When `true`, Google's `X-StaticMap-API-Warning` response header is surfaced as a non-fatal error (`err.isWarning = true`) in the `staticMap` callback, alongside the image data. By default warnings are silently ignored. |
| `places_default_radius` | boolean | `true` | When `true`, `placeSearch` defaults `radius` to 50000 meters (the max) if omitted and `rankby=prominence`. Set to `false` to omit the radius entirely (Google ranks differently without it). |
| `google_api_url` | string | `http://maps.googleapis.com` | Override the base API URL forHTTP requests. Useful for mocking in tests. |
| `google_secure_api_url` | string | `https://maps.googleapis.com` | Override the base API URL for HTTPS requests. |

### Mocking responses

To mock the Google API endpoints for local development or CI, override the
base URLs in your config:

```javascript
var config = {
  key:                  '<YOUR-KEY>',
  google_api_url:       'http://localhost:3000/fixture',
  google_secure_api_url: 'https://localhost:3443/fixture'
};
var gmAPI = new GoogleMapsAPI(config);
```

### Static Maps

```javascript
var gmAPI = new GoogleMapsAPI();
var params = {
  center: '444 W Main St Lock Haven PA',
  zoom: 15,
  size: '500x400',
  maptype: 'roadmap',
  markers: [
    {
      location: '300 W Main St Lock Haven, PA',
      label   : 'A',
      color   : 'green',
      shadow  : true
    },
    {
      location: '444 W Main St Lock Haven, PA',
      icon: 'http://chart.apis.google.com/chart?chst=d_map_pin_icon&chld=cafe%7C996600'
    }
  ],
  style: [
    {
      feature: 'road',
      element: 'all',
      rules: {
        hue: '0x00ff00'
      }
    }
  ],
  path: [
    {
      color: '0x0000ff',
      weight: '5',
      points: [
        '41.139817,-77.454439',
        '41.138621,-77.451596'
      ]
    }
  ]
};
gmAPI.staticMap(params); // return static map URL
gmAPI.staticMap(params, function(err, binaryImage) {
  // fetch asynchronously the binary image
});
```
This example prints the URL for the Static Map image: "https://maps.googleapis.com/maps/api/staticmap?center=444%20W%20Main%20St%20Lock%20Haven%20PA&zoom=15&size=500x400&maptype=roadmap&markers=color%3Agreen%7Clabel%3AA%7Cshadow%3Atrue%7C300%20W%20Main%20St%20Lock%20Haven%2C%20PA&markers=icon%3Ahttp%3A%2F%2Fchart.apis.google.com%2Fchart%3Fchst%3Dd_map_pin_icon%26chld%3Dcafe%257C996600%7C444%20W%20Main%20St%20Lock%20Haven%2C%20PA&path=weight%3A5%7Ccolor%3A0x0000ff%7Cenc%3A%7BbbzFfyvwMnFwP&style=feature%3Aroad%7Celement%3Aall%7Chue%3A0x00ff00"

By giving gm.staticMap an optional callback, you can retreive the static map PNG data:


You will get a map like:

![Some Map](https://maps.googleapis.com/maps/api/staticmap?center=444%20W%20Main%20St%20Lock%20Haven%20PA&zoom=15&size=500x400&maptype=roadmap&markers=color%3Agreen%7Clabel%3AA%7Cshadow%3Atrue%7C300%20W%20Main%20St%20Lock%20Haven%2C%20PA&markers=icon%3Ahttp%3A%2F%2Fchart.apis.google.com%2Fchart%3Fchst%3Dd_map_pin_icon%26chld%3Dcafe%257C996600%7C444%20W%20Main%20St%20Lock%20Haven%2C%20PA&path=weight%3A5%7Ccolor%3A0x0000ff%7Cenc%3A%7BbbzFfyvwMnFwP&style=feature%3Aroad%7Celement%3Aall%7Chue%3A0x00ff00)

For custom markers using the `icon` parameter, a little-known `scale` parameter is also available that makes it possible to use high-resolution custom images on devices  with retina displays. Set it to 2 and use it together with a `@2x` *http-only* image URL (Google's API does not support custom marker images served over https), such as:

```
{
  location: '999 Example Road, Earth',
  icon: 'http://example.com/path/to/custom-marker@2x.png',
  scale: 2
}
```

Credits to [this answer on SO](http://stackoverflow.com/questions/10336646/how-can-i-use-high-resolution-custom-markers-with-the-scale-parameter-in-google/17130379#17130379).

### Street view

```javascript
var gmAPI = new GoogleMapsAPI();
var params = {
  location: '51.507868,-0.087689',
  size: '1200x1600',
  heading: 108.4,
  pitch: 7,
  fov: 40
};
var result = gmAPI.streetView(params);
```

![London - Tower Bridge from London Bridge](https://maps.googleapis.com/maps/api/streetview?location=51.507868,-0.087689&size=1200x1600&heading=108.4&fov=40&pitch=7)

### Further examples

Please refer to the code, [tests](http://github.com/moshen/node-googlemaps/tree/master/test/) and the [Google Maps API docs](https://developers.google.com/maps/web-services/) for further usage information.


### Tests

The unit tests run offline with no credentials:

```
npm test
```

The integration tests make real requests to the Google Maps API and require a
valid, billing-enabled API key. Provide it via the `GOOGLE_MAPS_API_KEY`
environment variable (no key is committed to this repository):

```
GOOGLE_MAPS_API_KEY=your-key-here npm run integration-test
```

`GOOGLE_MAPS_SECURE` may be set to `false` to use http (defaults to `true` /
https). For local development you may instead create a git-ignored
`test/simpleConfig.json` of the form `{"key": "...", "secure": true}`.


### Contributions
Criticism/Suggestions/Patches/PullRequests are welcome.


### Original contributors list

[![evnm](https://secure.gravatar.com/avatar/2a8171b6c385b865e30bf070cf588329?s=50)](https://github.com/evnm)
[![duncanm](https://secure.gravatar.com/avatar/7310945bafb21aa68b18d61d8b9d2d61?s=50)](https://github.com/duncanm)
[![sugendran](https://secure.gravatar.com/avatar/3228aae57c1dc3f657bbc64c26c97b77?s=50)](https://github.com/sugendran)
[![JoshSmith](https://secure.gravatar.com/avatar/b07d5a5f2e75633b2085142250a6762b?s=50)](https://github.com/JoshSmith)
[![grobot](https://secure.gravatar.com/avatar/ba3313effc329919b09bca67827bdf10?s=50)](https://github.com/grobot)
[![regality](https://secure.gravatar.com/avatar/fe513a9e239cebde58187721d67b7505?s=50)](https://github.com/regality)
[![spatical](https://secure.gravatar.com/avatar/a7c5765a4a4dfbf697f728bd75223641?s=50)](https://github.com/spatical)

### v1.0.0 maintener
[![moshen](https://avatars0.githubusercontent.com/u/168513?v=3&s=50)](https://github.com/moshen)
[![fabriziomoscon](https://avatars1.githubusercontent.com/u/721890?v=3&u=b5079f5258887f4cc9a6de1cbadee230bca8ecc1&s=50)](https://github.com/fabriziomoscon)

Contributions and new issues are welcome!

---
_Source: https://npm.io/package/googlemaps · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
