Geolocation for Ember web apps


Hey, I just started contributing to Ember open source ecosystem and wanted to share my ember-addon with you.

I made HTML5 Geolocation implementation for Ember, because I needed to use Geolocation in my Ember web app and I found out that existing solutions were not complete enough and didn’t seem production-ready.

So I decided to write an easy-to-use and understandable wrapper for HTML5 Geolocation API with all the features needed to use it with Ember.

I will be happy to see you using it or contributing.

Here is the link:

I plan to maintain it constantly because I am using it in my real-world application.

Thanks :wink:


Hi igorpreston,

I am using your addons,but I am not getting location,

please help on that.give me real example on that.

I am writing this code in geolocator.js route but service doesnt return any value

import Ember from ‘ember’;

export default Ember.Route.extend({

geolocation: Ember.inject.service(),

actions: {
getUserLocation: function() {
  this.get('geolocation').getLocation().then(function(geoObject) {
    var currentLocation = this.get('geolocation').get('currentLocation');
    this.controllerFor('geolocator').set('userLocation', currentLocation);

} });



As I see you are using the example from dummy app inside the ember-cli-geo addon. The code above clearly gives geoObject which contains all data about user geolocation and it also sets the user current coordinates to the currentLocation property on the service.

So, you can use this in order to access user coordinates directly:

var that = this;
this.get('geolocation').getLocation().then(function(geoObject) {
  that.get('geolocation').get('currentLocation'); // this will give you coordinates, which you can store to any variable you want or display, or assign to another controller/route property.
  console.log("user coordinates are: " + that.get('geolocation').get('currentLocation')); // Use this to display coordinates in browser console

Also try console.log(geoObject); inside returned Promise to see what information the service returns about the user.

The service shouldn’t return you any value, it just lets you use geoObject after the geolocation is determined or use currentLocation property on service to retrieve user coordinates directly.

All specific functions to store or display geolocation wherever you need or want you should write yourself.

Also, I replied to your email, so please check it.


Hi Igor,

I tried to use this add-on, and this part of the instructions is not clear to me: “In order to use geolocation inside of your Ember.Route you should directly inject it to the one”.

What file does that code go in? Sorry, I’m very new to Ember.



I’m getting Error:

Cannot read property ‘get’ of undefined