limit in the geolocation of multiple points in google fusion tables - google-maps

I'm trying to geolocate these 27 points at the same time, in the same row. But the process returns only the first 10 points, even if in the preview they are all 27 correctly geolocated. Why? Is there a particular limit to the number of points I can locate?
<Point><coordinates>7.680237,45.064504,0.0</coordinates></Point>
<Point><coordinates>7.681675,45.061957,0.0</coordinates></Point>
<Point><coordinates>7.685044,45.060768,0.0</coordinates></Point>
<Point><coordinates>7.686482,45.06029,0.0</coordinates></Point>
<Point><coordinates>7.689443,45.05926,0.0</coordinates></Point>
<Point><coordinates>7.692157,45.060836,0.0</coordinates></Point>
<Point><coordinates>7.693799,45.062837,0.0</coordinates></Point>
<Point><coordinates>7.69352,45.06605,0.0</coordinates></Point>
<Point><coordinates>7.693316,45.065519,0.0</coordinates></Point>
<Point><coordinates>7.693723,45.065193,0.0</coordinates></Point>
<Point><coordinates>7.694796,45.069065,0.0</coordinates></Point>
<Point><coordinates>7.689893,45.072081,0.0</coordinates></Point>
<Point><coordinates>7.684025,45.075225,0.0</coordinates></Point>
<Point><coordinates>7.682716,45.075377,0.0</coordinates></Point>
<Point><coordinates>7.675881,45.078135,0.0</coordinates></Point>
<Point><coordinates>7.674809,45.076672,0.0</coordinates></Point>
<Point><coordinates>7.673264,45.074521,0.0</coordinates></Point>
<Point><coordinates>7.672727,45.073809,0.0</coordinates></Point>
<Point><coordinates>7.671729,45.072399,0.0</coordinates></Point>
<Point><coordinates>7.670302,45.071013,0.0</coordinates></Point>
<Point><coordinates>7.669648,45.070119,0.0</coordinates></Point>
<Point><coordinates>7.669197,45.068565,0.0</coordinates></Point>
<Point><coordinates>7.670592,45.06802,0.0</coordinates></Point>
<Point><coordinates>7.672427,45.067414,0.0</coordinates></Point>
<Point><coordinates>7.67557,45.065981,0.0</coordinates></Point>
<Point><coordinates>7.675592,45.06633,0.0</coordinates></Point>
<Point><coordinates>7.675892,45.064094,0.0</coordinates></Point>

The Google Maps reverse geocoder (whichever one you are using) is subject to a quota and a rate limit. If you don't check for and handle the status OVER_QUERY_LIMIT returned, you will get that behavior.
There used to be a limitation on multigeometries that only the 10 most prominent locations would show (can't find that in the documentation for FusionTables anymore though). Put each point in its own row.

Related

Google Place Search does not return result

I need to fetch location data based on given text.
As example if I search Aldi in google map it shows me lot of data with pagination. I need to get that result using google places api.
I tried it with two API calls. But it returns me following result
https://maps.googleapis.com/maps/api/place/textsearch/json?query=Aldi&key=MY_KEY
Result
{
"html_attributions" : [],
"results" : [],
"status" : "ZERO_RESULTS"
}
https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=ALDI&inputtype=textquery&fields=place_id,name,formatted_address,geometry&key=MY_KEY
Result
{
"candidates" : [],
"status" : "ZERO_RESULTS"
}
I need to fetch data based on the given name. Can anyone find out the reason.
There are three types of searches provided by the Places API: Find Place, Nearby Search and Text Search. Each allows you to specify a location with radius to start the search from. The location is specified as a latitude/longitude pair. You received ZERO_RESULTS because you didn't specify a location for your request. If the location parameter is not specified "the API uses IP address biasing by default" according to the documentation. So, there are no Aldi stores within range of the location of your IP address.
Find Place will only return one result though, in my experience, it sometimes returns two. Both Nearby Search and Text Search will return up to 60 place results. All three of the Place search requests allow specifying a radius around your location of up to 50 kilometers. If you need to find Aldi places worldwide you'll need to make quite a few requests.
I am weeks into a similar project to find all locations for a list of restaurant chains in the US. I have found that Nearby Search is a better choice for my use case and should be considered always before committing to Text Search for a project. I've tested Aldi searches with both Nearby Search and Text Search and found that they provide the identical set of place_id results. This Nearby Search request will find all Aldi locations within 50 kilometers of New York City:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=40.785276%2C-73.9651827&name=Aldi&radius=50000&key=MY_API_KEY
Here is the same as a Text Search:
https://maps.googleapis.com/maps/api/place/textsearch/json?query=Aldi&location=40.785276%2C-73.9651827&radius=50000&key=MY_API_KEY
So why should we care? Text Search according to API documentation "... returns all of the available data fields for the selected place, and you will be billed accordingly." Furthermore "... the Text Search service is subject to a 10-times multiplier. That is, each Text Search request that you make will count as 10 requests against your quota." A Nearby Search request is less expensive and not subject to the 10x multiplier. It returns a subset of the available data fields that you might find sufficient. If you need additional data fields, you can get only what you need from a Places Detail request. Do the math for your application before you select Text Search. It might be dramatically less expensive to implement using Nearby Search followed by Places Detail requests if necessary. In any case, you don't want to be shocked when you hit quota limits unexpectedly because of the 10x multiplier OR the billed transaction costs are more than you expect!
I have found additional hurdles that should be considerations for projects attempting to find all locations for a business in a large area:
The Places API will prefer places within your radius but will include places outside your radius if it determines they are relevant and within the 60 place limit. I have had places returned more than 450 kilometers from my requested search position.
Results are going to be returned for places with names that are NOT what you searched for. In my search for the restaurant Benihana in Seattle a Nearby Search request only returns a restaurant with the name Hamansu. Upon investigation, this is because there is not a Benihana in Seattle, however, Hamansu is similar to Benihana in that it serves Japanese dishes grilled tableside. The API documentation states your search term will be "matched against all content that Google has indexed for this place, including but not limited to name, type, and address, as well as customer reviews and other third-party content."
Results are returned 20 at a time. If there are more results, a page_token is provided to make a request to get the next page of up to 20 results. Each request is chargeable. You will be billed for the 3 requests required to get 60 results. I'm not saying this is bad, just be aware of the expense and quota usage you are incurring with this API.
If there are more than 60 results for your radius then you haven't found all the possible locations within it. And, you can't determine with certainty what the effective radius covered was for the 60 results. You need to search with a small enough radius to return < 60 results for each request. A worldwide search is going to require a large quota and $ budget to pursue.
You should be aware that Places API search is not designed to provide results world wide. In your examples you specify only text value 'Aldi'. However, in order to get results you should specify also where you are searching.
For example, if I want to bias results towards Barcelona area in Spain I have to add location and radius in my request
https://maps.googleapis.com/maps/api/place/textsearch/json?query=Aldi&location=41.3850639%2C2.1734035&radius=10000&key=MY_API_KEY
This request will return Aldi supermarkets in Barcelona area as shown in my screenshot
The same thing for Find place, you should specify location bias
https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=Aldi&inputtype=textquery&fields=formatted_address,geometry,name,place_id&locationbias=circle%3A1000%4041.3850639%2C2.1734035&key=MY_API_KEY
Also note that Find place returns only one result.
I hope this addresses your doubt.
#Art answer, which is marked with higher upvotes, is only partially correct. The answer suggests that the Find Place api (e.g. maps/api/place/findplacefromtext) will usually return 1 result, at most 2. I tend to agree with him. Even if your search hits multiple targets, only one would be returned with the Find Place api. Consequently, he recommends to use Nearby Search or Text Search, both of which would yield at most 60 results.
However, these two searches require some form of location parameter, otherwise they will likely return 0 results, defaulting to using your IP address, as he indicates. But he recommends using a location accompanied with a radius parameter. The problem with this is the radius parameter has a maximum limit. So it will not target all types of things you want if you are searching over the stretch of an entire country, such as the United States.
The truth is you do not need to use the location and radius. There is another option called region. And you can use region to search the entire distance of a country.
What #Art suggested:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=25.7392%2C-80.3103&name=Law%Offices%of%Alex&radius=50000&key=KEY
https://maps.googleapis.com/maps/api/place/textsearch/json?query=Law%Offices%of%Alex&location=25.7392%2C-80.3103&radius=50000&key=KEY
A more encompassing alternative:
https://maps.googleapis.com/maps/api/place/textsearch/json?query=Law%Offices%of%Alex&region=us&key=KEY
You need to specify the location of your search.

Google maps get list of Point of intrest

While requesting to get point of interests in google map's API, I am getting only 20 Results from any area or on any Lat, Long.
how can I get all the list of Point of interests
Get Point Of Intrest
As written in the Places API documentation on accessing additional results, places nearby search or text search returns up to 20 results per query, but each search request can have as many as 60 results divided into 3 pages.
If you have more than 20 results, you will have a next_page_token value in the response. Submit a new query passing the next_page_token to the pagetoken parameter to get the next 20 results. Like
https://maps.googleapis.com/maps/api/place/nearbysearch/json?pagetoken=[next_page_token from previous query here]&key=YOUR_API_KEY
With regards to getting more than 60 results
It is stated here on the issuetracker that it is not feasible due to technical concerns and that would turn the API into a database.

Google API - Place Search - RankBy Distance

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.

Google places radar search with a radius greater than 50,000 meters

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

Google Places API is returning inconsistent results (less than 200)

I am working with the Google Places API making an application that will grab place data and display it to users based on their location but I am getting some odd behaviour with the API it is as follows:
I will make a couple different requests such as:
https://maps.googleapis.com/maps/api/place/radarsearch/json?location=40.7128,-74.0059&radius=50000&type=restaurant&key=(api-key)
(This is New York City) But even with a 50km radius I get < 200 results which is the advertised max result count. There should be significantly more than 187 (my result count) restaurants within a 50km radius of that point in New York City.
I also tried this in Vancouver, BC, Canada:
https://maps.googleapis.com/maps/api/place/radarsearch/json?location=49.256639,%20-123.097963&radius=50000&type=restuarant&key=(api-key)
And I got 198 results, when I know for a fact there are thousands of restaurants in the Greater Vancouver Area. As can be seen below this is a 50 Km radius circle over Vancouver.
As my application depends on having that hard max (200) to determine if the radius needs to shrink or grow this behaviour seems out of the ordinary. I do know it used to work this way as an older application of mine was able to use the hard max to shrink/grow dynamically on calls.