Giter Club home page Giter Club logo

Comments (5)

onurmatik avatar onurmatik commented on May 28, 2024

I am having a similar problem. Triggering the geocoder via javascript as in examples such as:

  $("#examples a").click(function(){
    $("input[name=geo_autocomplete]").val($(this).text()).trigger("geocode");
    return false;
  });

returns a limited result set compared to selecting the same location manually. For example, the "name" attribute is occasionally populated, when when triggered via js.

from geocomplete.

onurmatik avatar onurmatik commented on May 28, 2024

I did some experiments on this. When a location is selected from the autocomplete list, request sent to the geocoding service is a PlaceService.GetPlaceDetails request with the location's ID. This returns the full result set. When geocoding is triggered via javascript giving a place name, even if the name is an exact match to the full name, the generated request is a GeocodeService.Search request, which returns a subset of the GetPlaceDetails request.

Apparently, the autocomplete drop-down has the ID of the location and builds the request based on that. But, as far as I can see, that ID is not provided in the results of a GeocodeService.Search request. So, making a search query, getting the id, and making another getDetails query won't seem to work neither.

Any suggestions?

from geocomplete.

itsmattsoria avatar itsmattsoria commented on May 28, 2024

@omat - thanks for figuring this out. I've been trying desperately to parse the extra place details that are retained only with the GetPlaceDetails request (specifically formatted_phone_number). Are you saying that these details are not retrieved only when trigger the geocoder via javascript? I can't seem to figure out how or where they are retrieved either way.

from geocomplete.

onurmatik avatar onurmatik commented on May 28, 2024

to get all the details, GetPlaceDetails should be called with the place id. there may be a way to query the geocoding service with name and retrieve the ID and then make the GetPlaceDetails request, i am not sure. otherwise, with the place name, you would do a GeocodeService.Search request and get a limited result about a place. at the time i was working on that, the id was not provided. it is probably still the same. good luck, and i'd appreciate if you share any updates on that.

from geocomplete.

martingg88 avatar martingg88 commented on May 28, 2024

The following solution may help. you can refer to this link for further details.

http://stackoverflow.com/questions/27865483/google-maps-api-autocomplete-search-without-selecting-from-dropdown

var _this = this.input;
google.maps.event.addDomListener(_this,'keydown',function(e){
console.log(e.triggered)
if(e.keyCode===13 && !e.triggered){
google.maps.event.trigger(_this,'keydown',{keyCode:40})
google.maps.event.trigger(_this,'keydown',{keyCode:13,triggered:true})
}
});

from geocomplete.

Related Issues (20)

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.