I can get to know the suburb using google maps api. I use Autocomplete getPlace() to get sublocality_level_1. I want to know the nearby sublocalities as well.
I tried nearbysearch with type="sublocality". That fetches only maximum two results per call. Fetch with radius 200m returns two sublocalities and fetch with radius 500m returns two other sublocalities.
I want to get all sublocalities around given place_id for given radius (say 5000m). Is there a way to get that?
Looks like Google Places API doesn't have support for getting the nearby suburbs. You can only get point of interests like Restaurants, Fuel Stations, etc.
You can you the getPlace() Google Places API autocomplete to get the latitude and longitude of your suburb, and use the geonames.org API for fetching the nearby suburbs/sub localities. You have the options to pass lat, lng and radius.
Here is a example GET for fetching suburbs near 13.041703, 80.251943 in 5 KM radius
http://api.geonames.org/findNearbyPlaceNameJSON?lat=13.041703&lng=80.251943&radius=5&username=demo
Related
In my google maps autocomplete server side query, i'm trying to return results around or near a latitude and longitude, I've tried this so far
https://maps.googleapis.com/maps/api/place/autocomplete/json?key=<<KEY>>&types=geocode&sensor=true&language=en&location=40.64131109999999%2C-73.77813909999998&strictBounds=true&radius=10&input=london
WHERE 40.64131109999999%2C-73.77813909999998 is the latitude and longitude of JFK - John F. Kennedy International Airport.
But when the search string is london, results still show. Any idea how to limit results within a certain radius / boundary or country? Thanks
Here are my findings on your URL request:
You have included strictBounds=true which is incorrect since parameters are case sensitive hence it will be omitted in the request. It should be strictbounds instead.
You also do not need the =true because adding the parameter strictbounds is enough to restrict the places returned within the defined location and radius.
The value of radius that you have included is too small (10) which may lead to ZERO_RESULTS
You may try this request instead:
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=london&location=40.64131109999999,-73.77813909999998&radius=10000&components=country:US&strictbounds&key=YOUR_API_KEY
As per the google api documentation its mentioned as:
"rank results strictly by distance. In order to rank results by distance you must use some form of query or filter on the search. This can be a name filter, a type filter, or a keyword search. When results are ranked by distance it is not necessary to provide a search radius as the Places API will try to return the 20 closest results within reasonable distance"
Reference:
https://maps-apis.googleblog.com/2012/05/google-places-api-search-refinements-as.html
My question here is, what's the maximum radius/distance the API uses internally to get the matching results?
Note: For radius, the api documentation says "The maximum allowed radius is 50 000 meters". But no information about maximum/default distance the result includes is mentioned for rankBy: google.maps.places.RankBy.DISTANCE.
Any information on this will be helpful.
According to Google team the radius used with rank by distance option is 7000 meters.
Take a look at the following answer in the public issue tracker:
https://issuetracker.google.com/issues/35824648#comment2
Indeed, rankby=distance uses a default radius, currently 7000 m, and only results within that radius will be returned.
I'm trying to find all Panera restaurants within a 200 mile radius of a certain point.
Here is the URL I have been using so far :
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=39.52963,-119.81380&radius=321869&type=restaurant&name=panera&key=your-key-here
However, I have found out that radius has a maximum of 30 miles. Can anyone suggest a quick workaround for me?
Thanks to all in advance.
Open Google Maps and save 8-10 or more points' lat,long value to trigger your request. Then use a loop to find all places within these points. If you want more precise results, increase first trigger points for your requests.
I tried, it works.
Assume we are using php
$triggerPoints = array("lat1,long1", "lat2,long2", "lat3,long3",....);
foreeach(triggerPoints as $t){
$requestUrl = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=$t&radius=[YOUR_RADIUS_VALUE]&type=restaurant&name=panera&key=your-key-here";
$results = file_get_contents($requestUrl);
//Do what you want with response JSON data
}
Important: When you choose trigger points, those points should intersect according to your radius value. So you don't miss any restaurants
Business license with for higher usage limits.
Contact Google sales
Google place nearby search maximum 50,000 meters (31 miles) .
if you try enter more than 50,000 it not work proper.
There is another way for find all restaurants in a city.
google provide Text Search Requests
https://maps.googleapis.com/maps/api/place/textsearch/json?query=restaurants+in+Reno,NV,89501,USA&key={API_KEY}
query = keyword + in + city Name
for get city name using latitude longitude
http://maps.googleapis.com/maps/api/geocode/json?latlng=39.52963,-119.81380&sensor=true
For more information how to get city name using latitude longitude
https://developers.google.com/maps/documentation/geocoding/start?csw=1#ReverseGeocoding
for more information about how to use Text Search Requests
https://developers.google.com/places/web-service/search
Does the viewports in the Google geocoding represents the boundary boxes of the location ? Iam trying to use google viewports of particular city or location to search for the latitude and longitude values that fall in those bounding values.
I have two tables called tblproperty and tblemailalerts, tblproperty has got latitude and longitude values and tblemailalerts also got viewport + latitude and longitude values . Now I want to get the sql to get the matching records with accuracy
I want to achieve similar to zoopla search
for example when user selects location as london , properties should be shown within the boundaries of london. If they select london within 1/4 mile radius i should get the properties within the london + properties with 1/4 radius
The viewport bounds parameter only biases the results. It's not a hard limit. You can read about viewport biasing in the API documentation.
However, the viewport returned by Google for a query for "London" does represent a bounding box you can use in your SQL query.
You could also use the OpenStreetMap API. The query to get a bounding box for London is:
http://nominatim.openstreetmap.org/search?q=London&format=json
In there you will find a number of bounding boxes for places called "London" around the world, but the first one is London, United Kingdom.
hey i just want to gather the locations in google maps database which are under 5 km radius of the given point.. i will be storing them in database for later processing .....can this be done...thanks...how to get longitude and latitude of points with in the required circle...
You can use PlaceSearches
with the parameter : radius