jshimko / meteor-geocomplete

Geocoding and Places Autocomplete Plugin
http://ubilabs.github.com/geocomplete/
44 stars 4 forks source link

Getting to Lat/Lng? #29

Closed acomito closed 8 years ago

acomito commented 8 years ago

When I console log the following, I am not getting anything... it says

function (){return a}

    this.autorun(function () {
        if (GoogleMaps.loaded()) {
            $("#Location_Input")
                .geocomplete()
                .bind("geocode:result", function(event, result){
                    console.log(result.geometry.location.lat);
                });
        }
    });

Everything else the input returns (that isn't in an object) returns fine.

acomito commented 8 years ago

covered here: https://github.com/jshimko/meteor-geocomplete/issues/7

jshimko commented 8 years ago

result.geometry.location.lat is a function.

jshimko commented 8 years ago
this.autorun(function () {
  if (GoogleMaps.loaded()) {
    $("#Location_Input")
      .geocomplete()
      .bind("geocode:result", function(event, result){
        const lat = result.geometry.location.lat();
        const lng = result.geometry.location.lng();

        console.log('Latitude: ', lat);
        console.log('Longitude: ', lng);
      });
  }
});