Exact address of a place given its latitude and longitude - go

I'm developing a web app wherein I need to get the "exact" address given a latitude and longitude pair. I tried Maps Geocode API as well but it doesn't give the exact address. I think Places API would be a good option alas I don't get how to use it.
I'm using golang.

IMO, if you think that reverse geocoding results a bad, Places API results wouldn't make you happier.
Here is the sample of Places API
https://maps.googleapis.com/maps/api/place/search/xml?location=55.753720,37.620144&key=google_map_api_key
And Geocoder to compare
https://maps.googleapis.com/maps/api/geocode/xml?latlng=55.753720,37.620144
As you can see, there is no address in Places API results. The first addresses you may get only after addition radius parameter:
https://maps.googleapis.com/maps/api/place/search/xml?location=55.753720,37.620144&radius=100&key=google_map_api_key
For me, trying to decide which address within 100 meters is right is more complex task than simple use of the best possible result from geocoding.

Related

GoogleMaps Autocomplete (Places API)

I am trying to fetch airports using the Places API autocomplete feature.
Looking at the types parameter, if this is an airport I display the result or else show it as no airports found.
I want to enhance this app, I want to show terminals within each Airport object that I display on the front end.
I have found the nearby search within places API but it is difficult to create a search query using keyword, and type to get exact results for all the airports around the world.
Does anyone have any idea as to what would be the best way to get airports and their terminals using the Places API?
Well I'm not sure if this is really your expected result but here's what I tried:
Get the placeId of an airport using Place Autocomplete.
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=dublin&radius=500&types=airport&key=API_KEY
Then use that placeId to do a Place Details request and get the coordinates of the airport.
https://maps.googleapis.com/maps/api/place/details/json?place_id=ChIJLxmTab4RZ0gRVfMlt7UbElU&key=API_KEY
This also returns an overview of the airport wherein in this case the result says: "
"Airport with 2 runways, a 2nd terminal opened in 2010 plus buses into Dublin & other towns/cities."
Then after having the coordinates, I use that to do a Nearby Search request.
https://maps.googleapis.com/maps/api/place/nearbysearch/json?keyword=terminal&location=53.42644809999999,-6.249909799999999&radius=10000&key=API_KEY
This managed to get the terminals around it, I just threw in some radius but I guess it should be different on other locations. I also tried this with other Airports and it somehow worked.
If this won't work for your use case. Another thing I think you could do is to store the coordinates of known airports (Please note that coordinates/placeID are the only thing that is allowed for us to store/cache. Please see Specific Terms). And create an object which also stores the coordinate of their corresponding terminals. This would be an extensive work if you want to do this with airports all around the world.
Hope this helps.

With Google Places API, how do I get all places in a rectangular zone?

For a mobile application, I would like to get all places included in a map screen view (hence the rectangular zone).
Reading the API's documentation, I found out that Find Place requests can use a rectangular location bias, but only answer with one place; on the other hand, Text Search requests return several places, but do not have rectangular location bias; moreover, both need some input text, which I don't want to provide.
Which request type is the best to match my problem? (maybe Places API offers a suitable request I don't know about)
Hey you could define a zone using latlong then use the Nearby Search Requests
and it should give you all places in that zone

Get the street names with Google API

Is there a way to get all the street names in an area with a Google API? Im trying to get all the street names from Sherwood Forest, Jacksonville, Florida.
As far as I know this is not possible with the Google API. You could search within a 50 mile radius for places ( using the places api ) and then parse each places address for streets and exclude duplicates.
If you do not need to use google maps then I would suggest looking at this.
http://www.openstreetmap.org/#map=2/71.3/-96.8

Google geocoding API - search in just one country

I am looking for geocodes with the google geocode-API:
http://maps.googleapis.com/maps/api/geocode/json?address=london%c2+UK&sensor=false
The problem is, that the input isn't very accurate (specially the street) and sometimes google mixes things up and ignores UK, because the street has a perfect match (as street and city) somewhere else. e.g. US.
Now i cannot solve this issue (input data), but I am wondering if there is a parameter, which forces google to search in UK and return no result instead of a completly wrong result.
You can add component filters in the url to constraint results. In this case you can use:
http://maps.googleapis.com/maps/api/geocode/json?address=london%c2+UK**&components=country:UK**&sensor=false
For more information about how to use component filtering see:
https://developers.google.com/maps/documentation/geocoding/intro#ComponentFiltering

Finding nearest street given a lat-long location

Is there any such API where given a location (in terms of latlong), I could find whether the given point is on road/street or not. And if possible also gives me nearest street/road to that location. I found API from [Find nearby Streets] -> http://www.geonames.org/maps/us-reverse-geocoder.html#findNearbyStreets , but it just gives solution for US.
Help me if u know of any better solution/algorithm. ( I am particularly interested in India.)
You can use the Google Maps Geocoding API which does exactly that: https://developers.google.com/maps/documentation/geocoding/intro
Take a look at the "Reverse Geocoding" section.
Google maps api provides reverse Geocoding api, you need to pass lat and long values to get address
http://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=true_or_false
Check this
http://code.google.com/apis/maps/documentation/geocoding/#JSON
Much simpler with OSRM (nearest) webservice. Look at my answer here:
https://stackoverflow.com/a/30403046/4640499

Resources