# leaflet-google-places-autocomplete

> Add google places autocomplete to your leaflet map

Latest version **0.0.9** (published 2020-06-03) · ISC license · 0 weekly downloads

## Install

```sh
npm install leaflet-google-places-autocomplete
pnpm add leaflet-google-places-autocomplete
yarn add leaflet-google-places-autocomplete
bun add leaflet-google-places-autocomplete
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.9 |
| Published | 2020-06-03 |
| First published | 2016-12-12 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 11.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 47 |
| Author | Michal Haták |
| Maintainers | twista |
| Keywords | leaflet, map, autocomplete |

## Links

- npm: https://www.npmjs.com/package/leaflet-google-places-autocomplete
- Repository: https://github.com/Twista/leaflet-google-places-autocomplete
- Homepage: https://github.com/Twista/leaflet-google-places-autocomplete#readme
- Issues: https://github.com/Twista/leaflet-google-places-autocomplete/issues
- npm.io page: https://npm.io/package/leaflet-google-places-autocomplete

## Recent versions

- 0.0.9 (latest) — 2020-06-03
- 0.0.8 — 2017-01-20
- 0.0.7 — 2017-01-20
- 0.0.6 — 2017-01-20
- 0.0.5 — 2016-12-14
- 0.0.4 — 2016-12-12

## README

# Leaflet Google Places Autocomplete

Simple extension to add Google Places autocomplete into map.


## Installation

### Bower

    bower install --save leaflet-google-places-autocomplete

### NPM

    npm install --save leaflet-google-places-autocomplete

## Usage

Make sure you have Google Places library **with valid API key** loaded on page.

```html
    <script src="https://maps.googleapis.com/maps/api/js?key=<key>&libraries=places"></script>
```

```javascript

new L.Control.GPlaceAutocomplete().addTo(map);

```

```javascript

new L.Control.GPlaceAutocomplete({
	callback: function(place){
		var loc = place.geometry.location;
		map.setView( [loc.lat(), loc.lng()], 18);
	}
}).addTo(map);

```

## API

#### <a name="autocompleteOptions"></a> Options

These options can be set up when creating the control with `autocompleteOptions`.

Option                | Default       | Version | Description
----------------------|---------------|---------|--------------------------------------------------
`position`            | `topright`    | v0.0.5  | any valid LeafLet [position](http://leafletjs.com/reference.html#control-positions)
`prepend`             | `true`:bool   | v0.0.5  | If true, control will prepended to other existing controls, if false, control will be appended
`callback`            | -             | v0.0.5  | any valid function as callback. By default internal callback is set and just pan the map to found position
`autocomplete_options`| {}            | v0.0.5  | default options for google autocomplete
`collapsed_mode`      | `false`:bool  | v0.0.6  | if set to true, then just click-able icon will be displayed
`placeholder`         | `null`:string | v0.0.9  | custom placeholder for input text

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