Search code examples
google-apigoogle-places-apigoogle-places

getting all cafes in specific area without using center point and radius


I've this URL from which I can find all the Cafes in the defined area using google apis:

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=26.272514,50.195682&radius=15000&types=cafe&key=<myAPI>

The area covered in the range above is within the circle shown below:

enter image description here

The actual area of the city I'm considering is as appearing below:

https://www.google.com.sa/maps/place/Al+Khobar/@26.2435009,50.0472298,11z/data=!4m5!3m4!1s0x3e49e839e8ef58d9:0xef778812d8b6aad1!8m2!3d26.2171906!4d50.1971381?hl=en

enter image description here

How can I get all the cafes which are exactly in this city (no more no less, without using radius)?


Solution

  • After digging at Google Places API here I found this code, which looks to be fine for me:

    https://maps.googleapis.com/maps/api/place/textsearch/json?query=cafes+in+Khobar&key=YOUR_API_KEY