Code Monkey home page Code Monkey logo

ember-google-maps's Introduction

Build Status

๐Ÿ“ Ember Google Maps

A lightweight, declarative, composable API for building ambitious map UIs in your Ember apps.

What this addon is:
  • โœ… A lightweight Ember API for working with Google Maps.
  • โœ… An on-demand, asynchronous loader for the Google Maps API.
What this addon is not:
  • โŒ A bulky, verbose wrapper that reimplements the entire Google Maps API.
  • โŒ A whitelist or option validator that is tightly coupled to Google's API.

๐Ÿ“Ž Documentation

View guides and documentation โ€บ

๐Ÿ‘ทโ€ Maintainers

This addon is maintained by Sander Melnikov @ campusboard.

๐Ÿ‘€ Alternatives

The two maintained alternatives are ember-g-map and ember-cli-g-maps.

Here's a very subjective ๐Ÿ˜ฌ comparison of the Ember + Google Maps integration addons available today:

ember-google-maps ember-g-map ember-cli-g-maps
Lightweight โœ… โœ… โŒ
Minimal wrapping โœ… โŒ โŒ
Async API loading โœ… โŒ โœ…
Official Google API โœ… โœ… โŒ
Leverages templates โœ… โœ… โŒ
Contextual components โœ… โŒ โŒ
Minimal observer usage โœ… โŒ โŒ
Native Ember HTML markers โœ… โŒ โŒ

ember-g-map provides a great template-oriented API for working with maps. It is however a bit long in the tooth for some refactoring and upgrades, like supporting contextual components and more Google Maps components. The current architecture makes adding these features quite involved. It also doesn't support loading the Google Maps API asynchronously and by default inserts a render-blocking script tag into your HTML!

ember-cli-gmaps actually uses a custom fork of gmaps โ€“ a wrapper for the Google Maps API. That's 3 whole layers of complex wrappers tightly coupled to their API all to render a map and some markers in Ember โ€“ be wary of this if you are conscious of build sizes and/or technical debt. It also doesn't utilize any of the paradigms that we love about Ember, like templates, contextual components, closure actions, etc.

If you don't need the Google API specifically, check out ember-leaflet.

Basic usage

Display a map centered around a set of coordinates ๐Ÿ—บ.

{{g-map lat='51.508530' lng='-0.076132' zoom=10}}

Display an array of locations using markers ๐Ÿ“.

{{#g-map lat='51.508530' lng='-0.076132' zoom=10 as |g|}}
  {{#each locations as |l|}}
    {{g.marker lat=l.lat lng=l.lng onClick=(action 'showDetails' l)}}
  {{/each}}
{{/g-map}}

Display a custom overlay, like a custom HTML marker using template blocks ๐Ÿ˜ฑ. This lets you do all sorts of fancy things, like adding CSS animations and binding data.

{{#g-map lat='51.508530' lng='-0.076132' zoom=10 as |g|}}
  {{#each rentals as |r|}}
    {{#g.overlay lat=r.lat lng=r.lng classNames='custom-marker'}}
      <div class="marker-content">
        <p class="price">{{r.price}}</p>
      </div>
    {{/g.overlay}}
  {{/each}}
{{/g-map}}

Learn more

Contributing

Installation

  • git clone https://github.com/sandydoo/ember-google-maps.git this repository
  • cd ember-google-maps
  • npm install

Setting up API keys

The dummy app and test suite is run using a live map instance, which means you need an API key. I do not provide API keys for testing โ€“ you need to generate your own.

You can create an API key by following the instructions here: Create API key.

Assign this key to the GOOGLE_MAPS_API_KEY variable in .env or just run this line, making sure to replace INSERT_YOUR_KEY_HERE with your actual key.

touch .env & echo 'GOOGLE_MAPS_API_KEY=<INSERT_YOUR_KEY_HERE>' > .env

Running tests

Run live tests:

ember test --server

Run test suite against all target versions:

ember try:each

Serving documentation/dummy app

ember serve

License

MIT ยฉ Sander Melnikov.

ember-google-maps's People

Contributors

ember-tomster avatar sandydoo avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.