Lat / Long in AJAX Search results

May 7, 2009 at 7:16 PM
Can we get the Lat / Long data in AJAX Search results returned by the GAPI control?

A sample code will be really helpful.

BTW, this is an awesome code. Thanks for putting it together.
May 8, 2009 at 6:37 AM


I played around with the srouce code and was able to add the Lat Long to the search results.

Just added the below two lines to the method public SearchResult(JsonObject jsonObject)


<font size="2">

_lat =


JsonHelper.GetJsonStringAsString(jsonObject, "lat");<font size="2">

_lng =


JsonHelper.GetJsonStringAsString(jsonObject, "lng");

Ofcourse, i also added two variables, _lat and _lng, and accordingly two properties to return these variable values.

Tested and it works just fine.

May 8, 2009 at 8:12 AM

I just added few new options which will allow extension of Gapi.NET without getting into the code like you did. The "SearchResult" class now exposes the underlying "JsonObject" class, so you can, if you want access any attribute of the results. Also, I've overloaded some "ToString" to allow clean and easy usage of the attributes:

            SearchResults searchResults2 = Searcher.Search(SearchType.Local, searchPhrase);
            foreach (SearchResult searchResult in searchResults2.Items)
                if (searchResult.JsonObject.ContainsKey("lat"))


In any case, thank you for the feedback.