Search code examples
google-mapsgoogle-apigoogle-searchgoogle-search-api

Retrieving Coordinates from just Google Search API alone


is it possible to do that out without a Google API map? I searched everywhere and could not find any help for it.


Solution

  • Certainly. This Google example shows some of their tricks.
    http://www.google.com/uds/samples/random/lead.html

    Or, using excerpt from my code

    var ls = new google.search.LocalSearch();
    ls.setCenterPoint('New York');
    ls.setSearchCompleteCallback(this, processResults, [ls]);
    ls.execute('Barnes & Noble');
    

    and callback

    processResults: function(searcher) {
        if (searcher.results && searcher.results.length > 0) {
            for (var i = 0; i < searcher.results.length; i++) {
                var result = searcher.results[i];
                alert(result.lat + '  ' + result.lng);
            }
        }
    }
    

    General information, I'm sure you've already seen this:
    http://code.google.com/apis/ajaxsearch/documentation/

    Braveyard in his question also provided working example
    Disable Highlighting in Google API WebSearch Result Title