google places - Get a list of street addresses from a lat/long - api

I need to be able to search for addresses within the radius of 500M-1000M from a lat-long. Google places seems to be able to do this and give it to me in JSON which is awesome, but it is only returning businesses and establishments. I want every postal address in this radius. I have tried adding:
&types=street_address but it returns no results.
Is this possible and has anyone got any info on how to do this.

Have you tried the Google Maps API Web Services
- in the Viewport Biasing section you can set bounds.

Related

Can I find out store name given latitude, logitude coordinates in react native

I am creating an iphone app, where I want to find out the store name from the latitude and longitude coordinates. Is there any such react native package that I can install ? BTW I am using expo platform.
Thanks,
You can use the Places API Nearby Search that is available on Google Maps Platform.
This API will let you search for places within a specified latitude and longitude. You can refine your search request by supplying keywords or specifying the type of place you are searching for.
For example in your case, you want to search for nearby "store" within 1500m radius of a point near Sydney, Australia: https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.865111,151.196121&radius=1500&type=store&key=YOUR_API_KEY
Here are the different Place Types you can use to refine your search request.
Please note that you will be needing an API key to authenticate each request to the API. Here is how you can get one: https://developers.google.com/places/web-service/get-api-key
I hope this helps!

Geocoding with rails search

I've been running into some location based searches using the Google Maps API (more of a structural issue on my end than any criticism of the mapping api)
For example, if a user searches for "Victoria, Canada" it will bring up results for "Victoria, Canada" as expected. However, if a user searches for "Canada," google returns a longitude and latitude for the middle of the country, which is essential for correctly centering the map. However, it will not display any results since the nearest location is too far away from the location returned by google. I'm filtering out results that are about 20 miles away.
Can the Google Maps API return anything that I could use to tell if a user has entered a state or country name? If not, has anyone developed a work around solution?
Ideally, I would like to avoid just ordering the results by nearest location. I don't want items for "Spain" showing up at the bottom of a list when a user searches for "United States." I would try to determine if the query is a state or country prior to the search, but this seems very daunting task given the different possible spelling of country and region names. If I was only expecting english spellings, it would be a much easier approach.
Assuming this is a form on a site that has a controller parse the form and send the request to Google's API, you could break the form out into address, city, state, and country (if needed) form elements then make the address and city required fields.
I'm doing a similar approach with a site I'm building using Google Places API and it seems to work for me.

limit address search by distance

I recently joined a team working on an application that maintains listings with addresses. The user searches, and includes their zipcode, and the application displays the distance to each listing. Currently we use the Google Maps API for this. Reading through questions here on StackOverflow seem to suggest that this is the best way of doing things:
php/mysql zip code proximity search
Search engine by distance
However, while reading through the API documentation, this seems to be expressly forbidden unless we also show a map for each result (and possibly also for each result we filter out, depending on how you read the following statement):
Use of the Distance Matrix API must relate to the display of information on a Google Map; for example, to determine origin-destination pairs that fall within a specific driving time from one another, before requesting and displaying those destinations on a map. Use of the service in an application that doesn't display a Google map is prohibited.
( https://developers.google.com/maps/documentation/distancematrix/ )
What's the best way to accomplish this without running afoul of any API terms?
do you consider the Geo::PostalCode module (perl)? It uses maxmind database to calculate distances between locations (and there is bind in different languages).

How can I use Google Maps API to search both places and postcodes?

I've been using the Google Maps Places API to do search a map for the iPhone, like in the Maps app itself. I use a line like this:
https://maps.googleapis.com/maps/api/place/search/json?location=%f,%f&rankby=distance&name=%#&sensor=true&key=%#
using NSString to enter the missing information. However, unlike the Maps app, this search only works for local places and not for postcodes or other information. It would appear that if I want it to accept postcodes, I have to create a geocode request:
https://maps.googleapis.com/maps/api/geocode/json?address=W1A+1AA&sensor=true
But then of course, this doesn't search place information. Like the Maps app, I want my app to seamlessly return the best results of both.
Before I go ahead and code it so that it uses two separate APIs, is there a better way of doing this? Should I be using a different API that works more like the search in the Maps app?
I've looked into this for something like looking into a specific service, let's say sushi, at a zip code for those who don't want to use location services. Unfortunately, it seems like you have to make two calls, one for geocoding and the other through Google Places to get the locations that are within the radius of the coordinates given in the geocoding call.
See:
Find all parks for a given zipcode with google maps
and
https://groups.google.com/forum/?fromgroups#!msg/google-places-api/P3iDK5kO7OM/Cek4BzeXMA4J

OSM API how to get all suburbs by city?

Can someone tell me how to get a list of suburbs by city (name,id,whatever) in OpenStreetMap API? I can't find any detailed documentation and the API is pretty abstract.
I'm looking at extended API, Xapi. I found how I can get nods and filter only suburbs, but I don't know how to set the city value.
http://www.informationfreeway.org/api/0.6/node[place=suburb]
Any other way or API is welcomed. Looked at geonames and google maps, but haven't found what I'm looking for. I need a list of all suburbs in Zagreb/Croatia and a way to check if a specific street is in that suburb. OSM has a pretty good and accurate data as I can see, but I'm having troubles with this API.
Have you tried setting the bounding box and then filtering the results to ensure that they are actually within Zagreb?
Here's a URL using a bounding box created on openstreetmap.org
http://open.mapquestapi.com/xapi/api/0.6/node[place=suburb][bbox=15.807,45.761,16.18,45.875]
This gives you names, but since I'm still new to OSM, I'm not quite sure how you establish their admin level and whether they actually lie within Zagreb or just within that bounding box. There may be further requests that could establish this info.
For your purposes I would use OSM Server Side Script
here is the documentation