Leaflet plugin for Google Places Autocomplete
JavaScript CSS HTML
Latest commit 29269ec Feb 20, 2017 @Twista remove screenshots
Permalink
Failed to load latest commit information.
example remove screenshots Feb 20, 2017
src djust button size, ll has 30x30 - not 26x26 Jan 20, 2017
LICENSE Initial commit Sep 26, 2016
README.md remove screenshots Feb 20, 2017
bower.json add examples into ignore directory Oct 6, 2016
package.json version bump Jan 20, 2017

README.md

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.

    <script src="https://maps.googleapis.com/maps/api/js?key=<key>&libraries=places"></script>
new L.Control.GPlaceAutocomplete().addTo(map);
new L.Control.GPlaceAutocomplete({
    position: "topleft",
    callback: function(location){
        // object of google place is given
        map.panTo(location);

    }
})
.addTo(map);

API

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
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