Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fourlabsldn/fl-google-maps-driver
Dead simple driver for google maps. Making creating maps, markers, infoWindows and marker animations simpler.
https://github.com/fourlabsldn/fl-google-maps-driver
Last synced: 5 days ago
JSON representation
Dead simple driver for google maps. Making creating maps, markers, infoWindows and marker animations simpler.
- Host: GitHub
- URL: https://github.com/fourlabsldn/fl-google-maps-driver
- Owner: fourlabsldn
- Created: 2016-09-20T09:42:58.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2016-09-27T09:21:11.000Z (about 8 years ago)
- Last Synced: 2024-09-18T11:03:28.474Z (about 2 months ago)
- Language: JavaScript
- Homepage: https://lazamar.github.io/fl-google-maps-driver/
- Size: 170 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Dead simple Google maps driver
[Checkout the example](https://cdn.rawgit.com/fourlabsldn/fl-google-maps-driver/7eed368ecd454d984cc634b84bd0b82465861d7f/examples/index.html)
## How to use:
Have a look at the examples folder.
``` javascript
const mapDriver = new MapDriver(google, '#map', { center: { lat: 51.473663, lng: -0.203287 }});// Crate markers with latitude and longitude
const marker = mapDriver.createMarker({
lat: 51.473663,
lng: -0.203287 ,
icon: 'http://example.com/icon.jpg'
});// Move marker
mapDriver.moveMarker(marker, { lat: 51.579663, lng: -0.613287 });// Set anination duration
mapDriver.moveMarker(marker, { lat: 51.579663, lng: -0.613287 }, 2500);// get locations for addresses
mapDriver.toLatLng('21 Heathmans Road, London, Uk')
.then(coord => {
const marker2 = mapDriver.createMarker({
lat: coords.lat,
lng: coords.lng,
});
});// Get existing markers
const allMarkers = mapDriver.getMarkers();// Focus markers
mapDriver.focusMarkers(allMarkers);// Destroy markers
mapDriver.destroyMarker(marker);
```## API
``` javascript
/**
* Adds a marker to this.markers list
* @private
* @method addMarker
* @param {Marker}
*/
addMarker(marker)/**
* Returns all markers currently in the map
* @public
* @return {Array}
*/
getMarkers()/**
* Creates a map marker
* @public
* @param {Object} config - Must have 'lat' and lng'
* @return {Marker}
*/
createMarker(config)/**
* Animates a marker to a specific coordinate
* @public
* @param {Marker} marker
* @param {Object} destination - 'lat' and 'lng'
* @param {Int} duration - In milliseconds
*/
moveMarker(marker, destination, duration = 1000)/**
* Removes a marker from the map.
* @public
* @param {Marker} marker
*/
destroyMarker(marker)/**
* Fits map's focus on specified markers
* @public
* @param {Array}
*/
async toLatLng(address)
```