All Projects → dburles → Meteor Google Maps

dburles / Meteor Google Maps

Licence: mit
🗺 Meteor package for the Google Maps Javascript API v3

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Meteor Google Maps

Google Maps
Google Maps Web Services API wrapper for .NET
Stars: ✭ 171 (-13.64%)
Mutual labels:  google-maps, google-maps-api
Ostrio Neo4jdriver
Most advanced and efficient Neo4j REST API Driver, with support of https and GrapheneDB
Stars: ✭ 55 (-72.22%)
Mutual labels:  meteor, meteor-package
Maplace.js
A Google Maps Javascript plugin for jQuery.
Stars: ✭ 1,021 (+415.66%)
Mutual labels:  google-maps, google-maps-api
Ostrio Analytics
📊 Visitor's analytics tracking code for ostr.io service
Stars: ✭ 9 (-95.45%)
Mutual labels:  meteor, meteor-package
Load Google Maps Api
🌏 A lightweight Promise-returning helper for loading the Google Maps JavaScript API
Stars: ✭ 166 (-16.16%)
Mutual labels:  google-maps, google-maps-api
Autocms
AutoCms is a simple solution for your Meteor.js app
Stars: ✭ 34 (-82.83%)
Mutual labels:  meteor, meteor-package
Magento2 Google Address Lookup
Provides an address lookup service on a Magento 2 store powered by the Google Places API
Stars: ✭ 46 (-76.77%)
Mutual labels:  google-maps, google-maps-api
Vue Meteor
🌠 Vue first-class integration in Meteor
Stars: ✭ 893 (+351.01%)
Mutual labels:  meteor, meteor-package
Instagram Clone
Web/Android/iOS app to share photos on Google Maps in < 300 lines of code. Features REST API, shake to undo, OAuth login etc.
Stars: ✭ 99 (-50%)
Mutual labels:  meteor, google-maps
Meteor Comments Ui
Simple templates for comment functionality in your Meteor App
Stars: ✭ 78 (-60.61%)
Mutual labels:  meteor, meteor-package
React Native Maps Directions
Directions Component for `react-native-maps`
Stars: ✭ 846 (+327.27%)
Mutual labels:  google-maps, google-maps-api
Meteor Reactive Publish
Reactive publish endpoints
Stars: ✭ 123 (-37.88%)
Mutual labels:  meteor, meteor-package
Mongol Meteor Explore Minimongo Devtools
In-App MongoDB Editor for Meteor (Meteor DevTools)
Stars: ✭ 846 (+327.27%)
Mutual labels:  meteor, meteor-package
Googleway
R Package for accessing and plotting Google Maps
Stars: ✭ 187 (-5.56%)
Mutual labels:  google-maps, google-maps-api
Wanderlust The Travellers App
👟 An android application for travellers which allows them to save their journey experiences at one place in an organizable way. For detailed description, read the README.md file. Moreover, the application's design follows the latest HCI and UI/UX design guidelines.
Stars: ✭ 23 (-88.38%)
Mutual labels:  google-maps, google-maps-api
Meteor Files
🚀 Upload files via DDP or HTTP to ☄️ Meteor server FS, AWS, GridFS, DropBox or Google Drive. Fast, secure and robust.
Stars: ✭ 1,033 (+421.72%)
Mutual labels:  meteor, meteor-package
Use Places Autocomplete
😎 📍 React hook for Google Maps Places Autocomplete.
Stars: ✭ 739 (+273.23%)
Mutual labels:  google-maps, google-maps-api
React Google Maps Api
React Google Maps API
Stars: ✭ 791 (+299.49%)
Mutual labels:  google-maps, google-maps-api
Bikedeboa
A (Progressive) Web App to find, map and review bike parkings in the cities of Brazil.
Stars: ✭ 54 (-72.73%)
Mutual labels:  google-maps, google-maps-api
Meteor Transactions
App level transactions for Meteor + Mongo
Stars: ✭ 115 (-41.92%)
Mutual labels:  meteor, meteor-package

Meteor Google Maps

Join the chat at https://gitter.im/dburles/meteor-google-maps

Latest version of the Google Maps Javascript API with an interface designed for Meteor.

  • Supports multiple map instances
  • Ability to only load the API when it's required
  • Provides callbacks for individual maps when they render
  • API key + libraries
  • StreetViewPanorama support

Table of Contents

Note

The maps API is client-side only. Server side support may be added soon.

Installation

$ meteor add dburles:google-maps

Alternatively if you wish to add the package from within another package and have GoogleMaps available outside of package scope, use api.imply in your package.js.

Examples

Reactive geolocation

How to create a reactive Google map

React example

Demo project for the examples below

Usage Overview

Call the load method to load the maps API.

if (Meteor.isClient) {
  Meteor.startup(function() {
    GoogleMaps.load();
  });
}

If you prefer to load the maps API only once it's required, you may do so from within a Template onRendered hook.

Template.contact.onRendered(function() {
  GoogleMaps.load();
});

Wrap the map template to set the width and height.

<body>
  <div class="map-container">
    {{> googleMap name="exampleMap" options=exampleMapOptions}}
  </div>
</body>
.map-container {
  width: 800px;
  max-width: 100%;
  height: 500px;
}

Pass through the map initialization options by creating a template helper. This will only run once.

Template.body.helpers({
  exampleMapOptions: function() {
    // Make sure the maps API has loaded
    if (GoogleMaps.loaded()) {
      // Map initialization options
      return {
        center: new google.maps.LatLng(-37.8136, 144.9631),
        zoom: 8
      };
    }
  }
});

Place the ready callback within the template onCreated callback. This is also where you handle map events and reactive updates.

Template.body.onCreated(function() {
  // We can use the `ready` callback to interact with the map API once the map is ready.
  GoogleMaps.ready('exampleMap', function(map) {
    // Add a marker to the map once it's ready
    var marker = new google.maps.Marker({
      position: map.options.center,
      map: map.instance
    });
  });
});

Access a map instance any time by using the maps object.

GoogleMaps.maps.exampleMap.instance

API

Blaze Template

{{> googleMap [type=String] name=String options=Object}}

  • type (Optional)
    • Currently supported types: Map, StreetViewPanorama (defaults to 'Map')
  • name
    • Provide a name to reference this map
  • options
    • Map initialization options

create

GoogleMaps.create({object})

An alternative to using the googleMap Blaze template. Call this function to create a new map instance and attach it to a DOM element.

Options:

  • name - Name to reference this map.
  • element - A DOM element to attach the map to.
  • options - The map options.
  • type (optional) - Map or StreetViewPanorama. Defaults to Map.

Example:

GoogleMaps.create({
  name: 'exampleMap',
  element: document.getElementById('exampleMap'),
  options: {
    center: new google.maps.LatLng(-37.8136, 144.9631),
    zoom: 8
  }
});

load

GoogleMaps.load([options])

Loads the map API. Options passed in are automatically appended to the maps url. By default v3.exp will be loaded. For full documentation on these options see https://developers.google.com/maps/documentation/javascript/tutorial#Loading_the_Maps_API

Example:

GoogleMaps.load({ v: '3', key: '12345', libraries: 'geometry,places' });

loadUtilityLibrary

GoogleMaps.loadUtilityLibrary('/path/to/library.js')

A method to ease loading external utility libraries. These libraries will load once the Google Maps API has initialized.

loaded

GoogleMaps.loaded()

Reactive method which returns true once the maps API has loaded, or after manually calling GoogleMaps.initialize() (See further down).

ready

GoogleMaps.ready('name', callback)

Runs once the specified map has rendered.

  • name String
  • callback Function

Example:

GoogleMaps.ready('exampleMap', function(map) {
  // map.instance, map.options
});

The callback function returns an object containing two properties:

  • instance
    • The Google map instance
  • options
    • The options passed through from the Template helper (see Usage Overview above)

You can also access this object directly by name:

GoogleMaps.maps.exampleMap

initialize

GoogleMaps.initialize()

This function is passed into the Google maps URL as the callback parameter when calling GoogleMaps.load(). In the case where the maps library has already been loaded by some other means, calling GoogleMaps.initialize() will set GoogleMaps.loaded() to true.

Mobile platforms

If you're targeting mobile platforms you'll need to configure the following access rules in mobile-config.js.

App.accessRule('*.google.com/*');
App.accessRule('*.googleapis.com/*');
App.accessRule('*.gstatic.com/*');

For more refer to the official documentation.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].