🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

leaflet-google-places-autocomplete

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

leaflet-google-places-autocomplete

Add google places autocomplete to your leaflet map

0.0.9
latest
Source
npm
Version published
Weekly downloads
2.6K
-1.45%
Maintainers
1
Weekly downloads
 
Created
Source

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({
	callback: function(place){
		var loc = place.geometry.location;
		map.setView( [loc.lat(), loc.lng()], 18);
	}
}).addTo(map);

API

Options

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

OptionDefaultVersionDescription
positiontoprightv0.0.5any valid LeafLet position
prependtrue:boolv0.0.5If true, control will prepended to other existing controls, if false, control will be appended
callback-v0.0.5any valid function as callback. By default internal callback is set and just pan the map to found position
autocomplete_options{}v0.0.5default options for google autocomplete
collapsed_modefalse:boolv0.0.6if set to true, then just click-able icon will be displayed
placeholdernull:stringv0.0.9custom placeholder for input text

Keywords

leaflet

FAQs

Package last updated on 03 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts