JQuery Location Picker plugin
This plugin allows to find and select location on OpenStreetMap map using Google geoode API for address autocomplete and reverse geocoding.
Supports address autocomplete search and location select on map click.
Address autocomplete is using Google Maps Api, Maps displayed via OpenLayers
Plugin saves location information in inputs and provides same data via callbacks.
#jquery #location-picker, #maps, #autocomplete, #geocode, #OpenStreetMap, #OSM, #OpenLayers
Features
- Location Search by address
- Address autocomplete
- Location pick on map click
- Reverse address geocode from location
- Initialize location picker with:
- current location
- custom address
- custom location(latitude,longitude)
- Save location data in inputs or use in js callbacks
- Specify custom map and inputs elements
Code Example & Minimal setup
See Sample.html demo for configuration and usage
Include required scripts:
then add location picker plugin reference:
Example markup:
Usage:
Location picker API Reference
locationPicker looks for elements with data-type='address', data-type='location-store' and data-type='map' in specified selector by default.
Those elements could be changed via initialization options.
Location selected callback function, initial location information could be passed as well.
All available options are:
Location Picker methods:
- getData() - returns current location data
- getAddress() - returns address string
- setAddress(address) - sets location picker address and shows location on map
- setLocation(lat, long) - sets location and reverse geocodes it's address
Contributors
- CDK2020 (https://redevs.org)