Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fl-google-maps-driver

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fl-google-maps-driver

Dead simple Google maps driver

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Dead simple Google maps driver

Checkout the example

How to use:

Give a look at the examples folder.

  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

  /**
   * Adds a marker to this.markers list
   * @private
   * @method addMarker
   * @param {Marker}
   */
  addMarker(marker)

  /**
   * Returns all markers currently in the map
   * @public
   * @return {Array<Marker>}
   */
  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<Marker}
   */
  focusMarkers(markers)

  /**
   * Converts an array into an object with 'lat' and 'lng'
   * @public
   * @param {String} address
   * @return {Promise<Object>}
   */
  async toLatLng(address)

Keywords

FAQs

Package last updated on 23 Sep 2016

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc