Place ID showing "NOT FOUND" error for place details API - outdated place ID - google-maps

Trying to use Places API but the place ID is not valid. I have tried to use the nearby search but I keep coming up with Not Found error or invalid ID.
It is a service area business so I got the ID from inspecting the Write a Review for the GB profile.
This is the nearby search string I'm using (with exact lat/long) but it's not returning the searched business (it does return nearby businesses). Found this from Place ID gives "NOT FOUND" error for place details API:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.944640,151.228100&key=API-KEY&rankby=distance&pagetoken=
A place ID is showing on Google but when I try to use it with my API, it says it needs to be refreshed in the cache.
I've tried the Google maps nearby search but I'm either not getting the URL string correct or it's just not working.
Name of company is: Key Solutions Locksmith (current - invalid - place ID: ChIJ4ZphJoX7c6kRcsTRFd-cd_Y)
This is the nearby search string I'm using (with exact lat/long) but it's not returning the searched business (it does return nearby businesses but they all seem to be storefront instead of service area.
Also tried: https://maps.googleapis.com/maps/api/place/autocomplete/json?input=NUMBER%20STREETNAME%20Street,%20Maroubra,%202035&types=address&components=country:au&key=API-KEY
with just the address but the place ID it returned shows no reviews so it's not connected to the actual service area business.
How can I get a new (refresh) my place ID to get it to work with the Places API?
Thanks

Related

Google Place Autocomplete API showing invalid address

We are currently trying the Google places autocomplete api, but it seems as though Google places autocomplete api also returns invalid (non existent) addresses in the search result.
We want to receive only valid / actual addresses when the user types in the address autocomplete, is there a way to do it?
I searched the api docs but couldn't find anything much helpful.
There is a google places validation api but it only validates after given a single address, but we want to show only valid/actual addresses on search autocomplete and also don't want to call validation api for each of the search result items.
Went through official doc and also experimented several stackoverflow answers but those didn't match our requirements.
SO ref-1
This is Working as Intended as of now
I tried reproducing the Autocomplete request using this:
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=332%20Kennedy%20drive,%20Torrington,%20CT&types=address&key=API_KEY
And the results returned has a long Place ID.
According to the Places API documentation:
"Place IDs uniquely identify a place in the Google Places database and on Google Maps."
The documentation also says that the API may return a different place ID in the response. These place ID types include:
Street addresses that do not exist in Google Maps as precise addresses, but are inferred from a range of addresses.
Segments of a long route, where the request also specifies a city or locality.
Intersections.
Places with an address component of type subpremise.
These IDs often take the form of a long string.
This explains why the API still returned a street address for the input =332 Kennedy drive, Torrington, CT using types=address. The use case of autocomplete is to help the users obtain the closest result even if they are requesting an ambiguous query. So the Autocomplete always tries to return the closest result to their input and types. In your case, it returned a street addresses that do not exist in Google Maps as precise addresses, but are inferred from a range of addresses.
There's a public bug on the issue tracker that is somehow related to this. On the comment #5, it says that:
Suggestions are sometimes created for addresses that may not exist, if there are chances that they do.
Retrieving details for such suggestions may result in the suggested address, if it actually exists or can be synthesized from existing data. Otherwise, the result may be a different address, one that actually exists.
Possible workaround
One thing you can do is to use the validation API.
But since you mentioned that you don't want to use it, I tried the Autocomplete request using this:
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=332%20Kennedy%20drive,%20Torrington,%20CT&types=establishment&key=API_KEY
I just changed the types=address to types=establishment and it seems to return legit addresses. I'm not sure if this would fit on your use case, so you can just comment down if it does not.
And if it does not, I found a similar public bug on the issue tracker which says that similar issues like these are currently being worked on by the Google engineers internally. So what I would advise you to do wait for on update from this public bug.
There's no definite timeline on how long this will be fixed, but you can star it to be notified whenever there's an update.
Hope this helps!
== UPDATE ==
I tried playing around with the types and got to a point where I tried putting an array of types from this table. I tried this:
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=332%20Kennedy%20drive,%20Torrington,%20CT&types=street_address|street_number|premise&key=API_KEY
and it did return some real addresses. I changed the types=address to types=street_address|street_number|premise. You could try it out yourself and play around with the types and see if it works for your use case.
for more information about types, here's a link to the documentation.

Google Place Details does not return photos array

I am sorry if this question has an answer somewhere, I have searched and did not find any answer and I don't know what to do anymore.
I am developing an Ionic3 application and I am trying to search for a place on Google maps and then retrieve photos related to that place using Google Place details API. But photos are not returned. I have tried multiple combinations, even tried other places. Some other fields are returned but just not photos.
This is how I tried to retrieve :
https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJN1t_tDeuEmsRUsoyG83frY4&fields=photo,name,rating,formatted_phone_number&key=YOUR_API_KEY
and I tried getting details via :
http.get(" https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJN1t_tDeuEmsRUsoyG83frY4&fields=photo,name,rating,formatted_phone_number&key=YOUR_API_KEY")
.subscribe((data)=>{
console.log(data)
});
I replaced the place id and API KEY with mine. But no photo is returned.
Some of the fields inputted are returned but not photos.
What is the best way to retrieve photos?
I feel this might be relevant for someone in this situation too. Going through the documentation again, I realized that Places API does not return photos for other types other than the following types: establishments, geographic locations, or prominent points of interest. Most of my place search types were routes so it didn't return photos. But when the types were changed to match the allowed ones, photos were returned.
For example, Places does not return photos of a particular street except if it is a prominent point of interest as indicated above.
To get photos of street, Street View API might be the better option.
in Place Details API (https://developers.google.com/places/web-service/details) will result you will get photo_reference and inside you will find photos[] array
Now the place photo service is apart of the places API
then use Place Photo Requests to get the photo.
have a look in below url for service call
https://maps.googleapis.com/maps/api/place/photo?photoreference=PHOTO_REFERENCE&sensor=false&maxheight=MAX_HEIGHT&maxwidth=MAX_WIDTH&key=YOUR_API_KEY
Refrence: (https://developers.google.com/places/web-service/photos)

(Instagram) Scrape All Facebook places_id 's in a region from without access token

How do I find all of the facebook_places_id's in Brooklyn? I need them to scrape Instagram's public website.
I am able to lookup places_id's for a single location by name. I am also able to query all photos/videos and metadata once I have the location ID. All of this is available without needing an access token.
Look up facebook_places_id 's
This url allows you to look up location_ids by name. For example, this returns close matches for "Brooklyn, New York" (you can enter this into any browser and see the result, no access key or login required. I recommend Firefox):
https://www.instagram.com/web/search/topsearch/?context=place&query=brooklyn+new+york
From the JSON returned, we can see that "Brooklyn, New York" has the facebook_places_id 212950988
Scrape metadata for a given facebook_places_id
This url will return JSON metadata about posts in Brooklyn:
https://www.instagram.com/graphql/query/?query_id=17881432870018455&id=212950988&first=12&after=0"
So I can get everything I want if I know the place, I just need a full list of places to ask for.
https://www.instagram.com/web/search/topsearch/?context=place&query=brooklyn+new+york
The id you get from the above API call is not facebook_places_id, it is instagram_location_id that you use in API call to get location posts.
Below is Facebook Graph API call to get facebook_places_id in one city or region specified by lat,lng and distance. However this required a facebook access_token
https://graph.facebook.com/search?q=coffee&type=place&center=45.5230622,-122.67648150000002&distance=5000&access_token=XXX
You can get the list of facebook_places_id and then use the below API call to get corresponding instagram_location_id, which you can use to get location posts data.
https://api.instagram.com/v1/locations/search?facebook_places_id=694471784029871&access_token=XXX
This API call requires a instagram access_token

How to fetch the address of few places on google map which show unavailable with given lat,lng

I am facing a problem which relates to geocoding in which using google geocode map api with given lat,lng (for example 32.983025 75.710981),the return result gives status as ZERO_RESULT. How can we handle this find to find the address for that particular lat,lng, which should be understandable by the end user.
You can check the status of the returned result. If the status is not OK then you can give an error message saying that the address was not found.
<status>OK</status>
You can also validate the input and inform the user that it needs to be in "lat, lon" format
Can check the status but it will be not user friendly as the address might be there but google map doesn't suggest any address as it might not be added or it might be newly added to map. So in order to handle you will check the status from the geode api and validate before showing to the end user.

Getting URL for the place using Google Places API

So I am able to successfully get a list of places but I just realized that the results do not contain the URL for the establishment. For e.g. I get Pizza Hut and the physical address for it but I do not get the URL for it (www.pizzahut.com). Is there a way to get this may be by doing an additional query?
If the external website is available for the place, it should be set in website in the query result. If url is set, then that is the Google Place Page URL entered for the establishment. The reference result may be used to query for the same place later. (Documentation)