geoplete
v2.0.0
Published
Autocompletion for places and addresses.
Readme
geoplete
Autocompletion for places and addresses. Checkout the demo. Uses awesomplete for UI, and furkot-geocode as a geocoder backend.
Install
$ npm install --save geopleteUsage
import geoplete from 'geoplete';
const input = document.querySelection('.input-field');
geoplete(input, { // input element to which geoplete attaches
type: 'address', // 'address' or 'place'
minChars: 4, // min number of characters before we query for matches
lang: 'en', // language - if not specified document.lang is used
bounds: [[W,S],[E,N]], // location hint - array of 2 [longitude, latitude] points
item: function () {}, // generate list item (see [awesomplete][awesomplete-extend])
geocoder: {
// see [furkot-geocode] for details
}
});When one of the values is selected input will event.
The detail field of the event contain place information:
place- place name (may be absent if address doesn't correspond to a named place)type- place typeaddress- formated addresshouse- building numberstreet- street namecommunity- neighborhood or villagetown- town or citycounty- administrative area more general than townprovince- state or province (usually abbreviated)country- country (short form but not abbreviated)
License
ISC © Damian Krzeminski
