{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import requests"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"import utils\n",
"\n",
"utils.load_env()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/langchain_core/_api/deprecation.py:141: LangChainDeprecationWarning: The class `GooglePlacesTool` was deprecated in LangChain 0.0.33 and will be removed in 0.3.0. An updated version of the class exists in the langchain-google-community package and should be used instead. To use it run `pip install -U langchain-google-community` and import as `from langchain_google_community import GooglePlacesTool`.\n",
" warn_deprecated(\n",
"/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/langchain_core/_api/deprecation.py:141: LangChainDeprecationWarning: The class `GooglePlacesAPIWrapper` was deprecated in LangChain 0.0.33 and will be removed in 0.3.0. An updated version of the class exists in the langchain-google-community package and should be used instead. To use it run `pip install -U langchain-google-community` and import as `from langchain_google_community import GooglePlacesAPIWrapper`.\n",
" warn_deprecated(\n"
]
},
{
"data": {
"text/plain": [
"'1. Fashion Island\\nAddress: 587-589/7-9, Ram Inthra Rd, Khwaeng Khan Na Yao, Khet Khan Na Yao, Krung Thep Maha Nakhon 10230, Thailand\\nGoogle place ID: ChIJd57HEQRjHTERG_xSTcdQoYs\\nPhone: 02 947 5000\\nWebsite: http://www.fashionisland.co.th/\\n\\n\\n2. Food Island-Fashion Island\\nAddress: 5/5-6 หมู่ 5 Fashion Island, Ram Inthra Rd, Khwaeng Khan Na Yao, บางเขน Krung Thep Maha Nakhon 10220, Thailand\\nGoogle place ID: ChIJxVlvKA9jHTERAaDXThEk0sU\\nPhone: Unknown\\nWebsite: https://www.fashionisland.co.th/\\n\\n\\n3. Fashion Island\\nAddress: 401 Newport Center Dr, Newport Beach, CA 92660, USA\\nGoogle place ID: ChIJUetYrofg3IARvxarZNginsY\\nPhone: (949) 721-2000\\nWebsite: https://www.fashionisland.com/?utm_source=soci&utm_medium=organic&utm_campaign=gmb_soci_listing\\n\\n\\n4. Grand Station @ Fashion Island\\nAddress: Fashion Island Shopping Mall คันนายาว Khet Khan Na Yao, Krung Thep Maha Nakhon 10230, Thailand\\nGoogle place ID: ChIJgYJ0xNxjHTERqh7EMAXGflk\\nPhone: 02 947 5000\\nWebsite: https://www.fashionisland.co.th/about-us/grandstation/\\n\\n\\n5. Pomelo Fashion Island\\nAddress: Unit GSSH101, 1st Floor, Fashion Island Shopping Mall, 587-589, Ramindra Rd, แขวงคันนายาว เขตคันนายาว กรุงเทพมหานคร 10230, Thailand\\nGoogle place ID: ChIJaYz1YRFjHTERHcxGtqrypsk\\nPhone: 02 000 6811\\nWebsite: https://www.pomelofashion.com/\\n\\n\\n6. Haborland Fashion Island\\nAddress: ศูนย์การค้า แฟชั่นไอส์แลนด์ ชั้น3, Khwaeng Khan Na Yao, Khet Khan Na Yao, Krung Thep Maha Nakhon 10230, Thailand\\nGoogle place ID: ChIJ7wF25A5jHTERyBbgZ24hjGU\\nPhone: 065 848 1000\\nWebsite: https://harborlandgroup.com/\\n\\n\\n7. IF Store art & chara สาขา Fasion Island\\nAddress: KI B006-B007 โซนแกรนด์สเตชั่น ซอย 7 ศูนย์การค้าแฟชั่นไอส์แลนด์ ชั้น 2 587,589, 589 7 9 Ram Inthra Rd, Khwaeng Khan Na Yao, Khet Khan Na Yao, Krung Thep Maha Nakhon 10230, Thailand\\nGoogle place ID: ChIJx5zaF3RjHTER8ROSKii-tVQ\\nPhone: 063 232 6356\\nWebsite: https://shopee.co.th/ifstore_art\\n\\n\\n8. Crush on Gelato สาขา Fasion island\\nAddress: RMGH+46W Fashion Island ชั้น 2 Staion B, Street 4, แขวงคันนายาว เขตคันนายาว กรุงเทพมหานคร 10230, Thailand\\nGoogle place ID: ChIJ69AOKABjHTERzQJJTyOunf4\\nPhone: 089 205 7502\\nWebsite: https://www.instagram.com/crush_on.gelato.bkk?igsh=azJiM3V4OGVscmpw\\n\\n\\n9. Panya Ramintra\\nAddress: Khan Na Yao, Bangkok 10230, Thailand\\nGoogle place ID: ChIJ9e97xwhjHTERR-MWDuKtUYY\\nPhone: Unknown\\nWebsite: Unknown\\n\\n\\n10. ร้านชุดชั้นใน GIRLY SECRET @Fasion Island\\nAddress: GIRLY SECRET แฟชั่นไอส์แลนด์ ชั้น2 โซนแกรนด์เสตชั่น สตรีท 11 Lat Phrao Road Khwaeng Khan Na Yao, คันนายาว Krung Thep Maha Nakhon 10230, Thailand\\nGoogle place ID: ChIJMRAHkpKd4jARZBQhL3tzF28\\nPhone: 092 697 9698\\nWebsite: Unknown\\n\\n\\n11. OkurimonoJapan! (Fashion Island)\\nAddress: Level 2, Ram Inthra Rd, Khwaeng Khan Na Yao, Khet Khan Na Yao, Krung Thep Maha Nakhon 10230, Thailand\\nGoogle place ID: ChIJUTgHRlBjHTERw3I3e-uH7hI\\nPhone: 080 594 4644\\nWebsite: Unknown\\n\\n\\n12. Opposite Fashion Island\\nAddress: Khan Na Yao, Bangkok 10230, Thailand\\nGoogle place ID: ChIJV8YMrwhjHTERTd8eEupPwZY\\nPhone: Unknown\\nWebsite: Unknown\\n\\n'"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from langchain_community.tools import GooglePlacesTool\n",
"\n",
"places = GooglePlacesTool()\n",
"places.run(\"fasion islands\")"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"#find places id\n",
"#near by search"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'candidates': [{'formatted_address': '444 ถ. พญาไท แขวงวังใหม่ เขตปทุมวัน กรุงเทพมหานคร 10330 ไทย', 'geometry': {'location': {'lat': 13.744677, 'lng': 100.5295593}, 'viewport': {'northeast': {'lat': 13.74598387989272, 'lng': 100.5309299798927}, 'southwest': {'lat': 13.74328422010728, 'lng': 100.5282303201073}}}, 'name': 'เอ็ม บี เค เซ็นเตอร์', 'opening_hours': {'open_now': True}, 'rating': 4.3}], 'status': 'OK'}\n"
]
}
],
"source": [
"def find_place_from_text(input_text, location=None, radius=2000):\n",
" # Retrieve the API key from environment variables\n",
" api_key = os.getenv('GPLACES_API_KEY')\n",
"\n",
" if not api_key:\n",
" raise ValueError(\"API key not found. Please set the GOOGLE_MAPS_API_KEY environment variable.\")\n",
"\n",
" # Define the endpoint URL\n",
" url = \"https://maps.googleapis.com/maps/api/place/findplacefromtext/json\"\n",
"\n",
" # Define the parameters for the request\n",
" params = {\n",
" 'fields': 'formatted_address,name,rating,opening_hours,geometry',\n",
" 'input': input_text,\n",
" 'inputtype': 'textquery',\n",
" 'key': api_key\n",
" }\n",
" \n",
" params['locationbias'] = f'circle:{radius}@{location}' if location is not None and radius is not None else None\n",
"\n",
" # Make the request to the Google Maps API\n",
" response = requests.get(url, params=params)\n",
"\n",
" # Check if the request was successful\n",
" if response.status_code == 200:\n",
" return response.json() # Return the JSON response\n",
" else:\n",
" response.raise_for_status() # Raise an exception for HTTP errors\n",
"\n",
"# Example usage:\n",
"location = \"15.87,100.9925\" # Latitude and Longitude\n",
"input_text = \"มาบุญครอง\"\n",
"result = find_place_from_text(input_text, location)\n",
"\n",
"print(result)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Coordinates: 13.744677,100.5295593\n"
]
}
],
"source": [
"def find_location(input_text:str, location:str=None, radius=10000):\n",
" # Call the find_place_from_text function to get the location data\n",
" data = find_place_from_text(input_text, location, radius)\n",
"\n",
" # Extract the latitude and longitude from the response\n",
" candidates = data.get('candidates', [])\n",
" if len(candidates)==0:\n",
" raise ValueError(\"No location found.\")\n",
"\n",
" # Assuming we're taking the first candidate\n",
" geometry = candidates[0].get('geometry', {})\n",
" location = geometry.get('location', {})\n",
"\n",
" latitude = location.get('lat')\n",
" longitude = location.get('lng')\n",
"\n",
" if latitude is None or longitude is None:\n",
" raise ValueError(\"Latitude or Longitude not found in the response.\")\n",
"\n",
" # Return the latitude and longitude as a formatted string\n",
" return f\"{latitude},{longitude}\"\n",
"\n",
"\n",
"location = \"15.87,100.9925\" # Latitude and Longitude\n",
"input_text = \"มาบุญครอง\"\n",
"coordinates = find_location(input_text, location)\n",
"print(f\"Coordinates: {coordinates}\")"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[{'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7491743, 'lng': 100.5161575},\n",
" 'viewport': {'northeast': {'lat': 13.75056342989272,\n",
" 'lng': 100.5175915298927},\n",
" 'southwest': {'lat': 13.74786377010728, 'lng': 100.5148918701073}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/restaurant-71.png',\n",
" 'icon_background_color': '#FF9E67',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/restaurant_pinlet',\n",
" 'name': 'White Flower',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 3024,\n",
" 'html_attributions': ['Natthapong Taweesook'],\n",
" 'photo_reference': 'AXCi2Q4ixaFFCtaz0ysxevjz-lWDMlygAsaAcEE2XLZabgjf4qZw-rHYlOQUP9dTGXWhy3j-U96v8GRPBu7FY0c4eA8fNoJta4-oG2lATPR0ERQ3lsTmU6FOii4XgWUHWmZp4b37hZWJEL5rYUx-NBTvt6ZtpBUc0EE0UZ5HYATIUEBxWIE',\n",
" 'width': 4032}],\n",
" 'place_id': 'ChIJl9od-jqZ4jARVmMNi4wBU2o',\n",
" 'plus_code': {'compound_code': 'PGX8+MF Bangkok',\n",
" 'global_code': '7P52PGX8+MF'},\n",
" 'price_level': 3,\n",
" 'rating': 4.4,\n",
" 'reference': 'ChIJl9od-jqZ4jARVmMNi4wBU2o',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['restaurant', 'point_of_interest', 'food', 'establishment'],\n",
" 'user_ratings_total': 2323,\n",
" 'vicinity': '678/1-7 Bamrung Mueang Rd, Wat Thep Sirin, Pom Prap Sattru Phai'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7449251, 'lng': 100.514918},\n",
" 'viewport': {'northeast': {'lat': 13.74623957989272,\n",
" 'lng': 100.5163598298927},\n",
" 'southwest': {'lat': 13.74353992010728, 'lng': 100.5136601701073}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/restaurant-71.png',\n",
" 'icon_background_color': '#FF9E67',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/restaurant_pinlet',\n",
" 'name': 'Lung & Pa',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 3024,\n",
" 'html_attributions': ['Mongkol Yongrakkiat'],\n",
" 'photo_reference': 'AXCi2Q7uzm3mBjDShx0q0RFXgZaOMQD0cxO_gih8HbXo3QF1uLuy-YMHiDQqs6PP9Ule8XzWJ_mlax9ntxLndIT74JPX-smiZ-0nuxQEkn8tqqJZ_BfqDWJlGgZR9J4dkf_4i4o5xQNJo_gbvD6piZor39uOvwsA8LHidnAVQduWwfcdW9yC',\n",
" 'width': 4032}],\n",
" 'place_id': 'ChIJB0JM5CSZ4jARZ0sxEfceIho',\n",
" 'plus_code': {'compound_code': 'PGV8+X2 Bangkok',\n",
" 'global_code': '7P52PGV8+X2'},\n",
" 'price_level': 1,\n",
" 'rating': 4.6,\n",
" 'reference': 'ChIJB0JM5CSZ4jARZ0sxEfceIho',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['restaurant', 'point_of_interest', 'food', 'establishment'],\n",
" 'user_ratings_total': 125,\n",
" 'vicinity': '34/3 Mittraphan Rd, Pom Prap, Pom Prap Sattru Phai'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7539337, 'lng': 100.5418347},\n",
" 'viewport': {'northeast': {'lat': 13.75527512989272,\n",
" 'lng': 100.5432228298927},\n",
" 'southwest': {'lat': 13.75257547010728, 'lng': 100.5405231701073}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/restaurant-71.png',\n",
" 'icon_background_color': '#FF9E67',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/restaurant_pinlet',\n",
" 'name': 'Pratunam Thai Food~Authentic (Cook by thai chef) / ร้านอาหาร ประตูน้ำไทยฟู้ด',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 809,\n",
" 'html_attributions': ['A Google User'],\n",
" 'photo_reference': 'AXCi2Q5dMTyeHD1SCh3CqUEvstb8SO-1bDvrMdYByrTHBwiiH427Pm4rUg5XkXLWmz7N56dTwWtSMPMt6K6PJ0sSt8hQvcVtjDKMG-4raiz2WLL5MpLVApuDUqJi-TACjjeuKUe3w78igpYx3-icU8OuibBiMGmfcl0T7xf0AcPa3-9xTbiQ',\n",
" 'width': 1440}],\n",
" 'place_id': 'ChIJbclEnumf4jARYQQZzBKxU18',\n",
" 'plus_code': {'compound_code': 'QG3R+HP Bangkok',\n",
" 'global_code': '7P52QG3R+HP'},\n",
" 'rating': 4.8,\n",
" 'reference': 'ChIJbclEnumf4jARYQQZzBKxU18',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['restaurant', 'point_of_interest', 'food', 'establishment'],\n",
" 'user_ratings_total': 63,\n",
" 'vicinity': '190 3 ถนน พญาไท Khwaeng Makkasan, Ratchathewi'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7380932, 'lng': 100.5168921},\n",
" 'viewport': {'northeast': {'lat': 13.73944302989272,\n",
" 'lng': 100.5182419298927},\n",
" 'southwest': {'lat': 13.73674337010728, 'lng': 100.5155422701073}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/restaurant-71.png',\n",
" 'icon_background_color': '#FF9E67',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/restaurant_pinlet',\n",
" 'name': 'Supa Restaurant',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 4640,\n",
" 'html_attributions': ['A Google User'],\n",
" 'photo_reference': 'AXCi2Q4mx5avzKKZkh4w3rBdieP5I83mY1yBwdhVg9Fxi1fkxDZOpZi18o20kgB8m8l28loJY1QVMVW1-tf3LT_zK8I5czm7RI35fp2zH2H8iksLH7f618cw-KvY3x7MQwAxmCCisy7DMiwmbOlkQJoMZQGrdwRDOrzC7KvugMH4WGkNL6Je',\n",
" 'width': 3472}],\n",
" 'place_id': 'ChIJE3_so2WZ4jARDbO3ktHv2kU',\n",
" 'plus_code': {'compound_code': 'PGQ8+6Q Bangkok',\n",
" 'global_code': '7P52PGQ8+6Q'},\n",
" 'rating': 4.9,\n",
" 'reference': 'ChIJE3_so2WZ4jARDbO3ktHv2kU',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['restaurant', 'point_of_interest', 'food', 'establishment'],\n",
" 'user_ratings_total': 38,\n",
" 'vicinity': '512 Rong Mueang Rd, Khwaeng Rong Muang, Pathum Wan'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7295572, 'lng': 100.5232952},\n",
" 'viewport': {'northeast': {'lat': 13.73092007989272,\n",
" 'lng': 100.5246405298927},\n",
" 'southwest': {'lat': 13.72822042010728, 'lng': 100.5219408701073}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/restaurant-71.png',\n",
" 'icon_background_color': '#FF9E67',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/restaurant_pinlet',\n",
" 'name': 'Dao Restaurant',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 2252,\n",
" 'html_attributions': ['A Google User'],\n",
" 'photo_reference': 'AXCi2Q4BzvEb42f7FxJHcsZQg0Hc0OjsifpJjgHykRE2vm2fsvzUxEywCnlGirFrZ2tdgynB42S29hqYJ2SmVvazS7v1pXhCC1JNe7j2F1qt7oImFEBOPHnvLzEU-HUJg40B0JeJfEV3bw0LjCwk2oqV-KOgPH_EDOgYPjDlthCx1JlrBflO',\n",
" 'width': 4000}],\n",
" 'place_id': 'ChIJV3Ra-NOY4jARZsqKoJRW5PE',\n",
" 'plus_code': {'compound_code': 'PGHF+R8 Bangkok',\n",
" 'global_code': '7P52PGHF+R8'},\n",
" 'rating': 4.8,\n",
" 'reference': 'ChIJV3Ra-NOY4jARZsqKoJRW5PE',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['restaurant', 'point_of_interest', 'food', 'establishment'],\n",
" 'user_ratings_total': 121,\n",
" 'vicinity': '68 Amon Rattana Dilok Alley, Si Phraya, Bang Rak'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7371139, 'lng': 100.51473},\n",
" 'viewport': {'northeast': {'lat': 13.73846577989272,\n",
" 'lng': 100.5160974298927},\n",
" 'southwest': {'lat': 13.73576612010728, 'lng': 100.5133977701073}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/restaurant-71.png',\n",
" 'icon_background_color': '#FF9E67',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/restaurant_pinlet',\n",
" 'name': 'Khao Moo Daeng Si Morakot',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 3456,\n",
" 'html_attributions': ['bow nattanan'],\n",
" 'photo_reference': 'AXCi2Q4cH7iovrhc8Js5Ax2_uhzM_fo4CioUNKy_OEUeDbskuGhvllYzyEeeQ5A9akJ_9hO0LbuiH6W3JnJlcWTDBDTtJFmjReeFZrmsW35f23_gQGHWUQPKqrDGjIKbUyksL4DCrT9ZJmRkMFvuJuw3PHZ2Xil1EgOIKC5PdcGyYUi4D_0-',\n",
" 'width': 4608}],\n",
" 'place_id': 'ChIJ-bLUEyeZ4jARupp8yg3g8MA',\n",
" 'plus_code': {'compound_code': 'PGP7+RV Bangkok',\n",
" 'global_code': '7P52PGP7+RV'},\n",
" 'price_level': 2,\n",
" 'rating': 4.3,\n",
" 'reference': 'ChIJ-bLUEyeZ4jARupp8yg3g8MA',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['restaurant', 'point_of_interest', 'food', 'establishment'],\n",
" 'user_ratings_total': 1848,\n",
" 'vicinity': '80 82 Sukon 1 Alley, Talat Noi, Samphanthawong'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.74873, 'lng': 100.5419459},\n",
" 'viewport': {'northeast': {'lat': 13.75011277989272,\n",
" 'lng': 100.5432604798927},\n",
" 'southwest': {'lat': 13.74741312010728, 'lng': 100.5405608201073}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/restaurant-71.png',\n",
" 'icon_background_color': '#FF9E67',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/restaurant_pinlet',\n",
" 'name': 'Krua Aroi',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 4032,\n",
" 'html_attributions': ['A Google User'],\n",
" 'photo_reference': 'AXCi2Q6hFRL-eW_ig6JO39OYAYDBgUch-HD9-tkZBNpHiBHKUABxw7cpP84ZRWI1s8IU7J0fbN84lmM8m3rtYtZU-5fX0nLaWe9PA_U2oOwuAcGlEs0v3N_lONWKtwThiW7dkF93ie05vDVI8IZ4SQZiScseiEGMQC3JqmE9A1_OuGBbdoSF',\n",
" 'width': 3024}],\n",
" 'place_id': 'ChIJ371CmcWe4jARYiOXygYM3zY',\n",
" 'plus_code': {'compound_code': 'PGXR+FQ Bangkok',\n",
" 'global_code': '7P52PGXR+FQ'},\n",
" 'price_level': 1,\n",
" 'rating': 4.5,\n",
" 'reference': 'ChIJ371CmcWe4jARYiOXygYM3zY',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['restaurant', 'point_of_interest', 'food', 'establishment'],\n",
" 'user_ratings_total': 199,\n",
" 'vicinity': '17 ซอย ราชดำริ1 Lumphini, Pathum Wan'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7526881, 'lng': 100.5418073},\n",
" 'viewport': {'northeast': {'lat': 13.75407252989272,\n",
" 'lng': 100.5431658798927},\n",
" 'southwest': {'lat': 13.75137287010728, 'lng': 100.5404662201073}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/restaurant-71.png',\n",
" 'icon_background_color': '#FF9E67',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/restaurant_pinlet',\n",
" 'name': 'Sakha Restaurant',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 4032,\n",
" 'html_attributions': ['Morris'],\n",
" 'photo_reference': 'AXCi2Q7S1FTMJ_bvfdmunjgM-TNzCk_FGjv4Fth1H6ZiMQSVH05fwqPNgGSC-I59SeVP_fZlyQzCh0dgXfx-mTbOgNCryKDqUuQjWq2EI4X_wGLU2q5LmreCTUr64gx_pRa6XsHDWO6AHPO9bL1-NLgrllOee0hFuhC0lBk-mmn4QIwUevpY',\n",
" 'width': 3024}],\n",
" 'place_id': 'ChIJVf0_Fsae4jARu_sU5nUULtA',\n",
" 'plus_code': {'compound_code': 'QG3R+3P Bangkok',\n",
" 'global_code': '7P52QG3R+3P'},\n",
" 'rating': 4.5,\n",
" 'reference': 'ChIJVf0_Fsae4jARu_sU5nUULtA',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['restaurant', 'point_of_interest', 'food', 'establishment'],\n",
" 'user_ratings_total': 59,\n",
" 'vicinity': '447/37 Soi Ratchaprarop 4, Makkasan, Ratchathewi'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7453562, 'lng': 100.5337972},\n",
" 'viewport': {'northeast': {'lat': 13.74668762989272,\n",
" 'lng': 100.5351349798927},\n",
" 'southwest': {'lat': 13.74398797010728, 'lng': 100.5324353201073}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/restaurant-71.png',\n",
" 'icon_background_color': '#FF9E67',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/restaurant_pinlet',\n",
" 'name': 'Ohkajhu Siam Square One',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 3072,\n",
" 'html_attributions': ['John May'],\n",
" 'photo_reference': 'AXCi2Q7ffiPwCHp2wi-dX3xPzje88ND2q8wopwMbR-K9St5XXsHdPqROvPfF84UcojvZltmAgTkmVLqRS1lkZUSNbZVV0QQBKqBGSoU-8juXJ9IuIW5brJmR8ExDmLa6v9oOgTx4C3spPFJNoDjxghkdb9hjPJP-cLQXd9T85RpjYaRCpqoN',\n",
" 'width': 4080}],\n",
" 'place_id': 'ChIJV157mDGZ4jARrvO4db7HAvw',\n",
" 'plus_code': {'compound_code': 'PGWM+4G Bangkok',\n",
" 'global_code': '7P52PGWM+4G'},\n",
" 'rating': 4.3,\n",
" 'reference': 'ChIJV157mDGZ4jARrvO4db7HAvw',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['restaurant',\n",
" 'health',\n",
" 'point_of_interest',\n",
" 'food',\n",
" 'store',\n",
" 'establishment'],\n",
" 'user_ratings_total': 1342,\n",
" 'vicinity': 'Unit #SS 3009, 388 Rama I Rd, Pathum Wan'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7466714, 'lng': 100.5398638},\n",
" 'viewport': {'northeast': {'lat': 13.74802122989272,\n",
" 'lng': 100.5412136298927},\n",
" 'southwest': {'lat': 13.74532157010728, 'lng': 100.5385139701073}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/restaurant-71.png',\n",
" 'icon_background_color': '#FF9E67',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/restaurant_pinlet',\n",
" 'name': 'Baan Ying Isan & Grill, Floor 3',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 3024,\n",
" 'html_attributions': ['A Google User'],\n",
" 'photo_reference': 'AXCi2Q6YZNIIxptJDsyIN5o8J3sHVNrxsEH8Fe8dIkjlr308iv4sIzjk6DPvlxo9R2U-ootusqzwI9sfKxhE7ovy00v1al8Uuleriuh0c9CqSy20l7OS6oEAIHpcAAISbsSfRNKQeM5DvAiBLafRtvxuZWCv_SK9nAB135sxe6BWlUOEIf9J',\n",
" 'width': 4032}],\n",
" 'place_id': 'ChIJp04t5s-e4jARy8oMsCZT4fg',\n",
" 'plus_code': {'compound_code': 'PGWQ+MW Bangkok',\n",
" 'global_code': '7P52PGWQ+MW'},\n",
" 'rating': 4.1,\n",
" 'reference': 'ChIJp04t5s-e4jARy8oMsCZT4fg',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['restaurant', 'point_of_interest', 'food', 'establishment'],\n",
" 'user_ratings_total': 387,\n",
" 'vicinity': '4, 4/1-4/2,4/4, Central World, 3rd Floor, Rajdamri Road, Pathumwan, Pathum Wan'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.734214, 'lng': 100.5273655},\n",
" 'viewport': {'northeast': {'lat': 13.73559442989272,\n",
" 'lng': 100.5287203298927},\n",
" 'southwest': {'lat': 13.73289477010728, 'lng': 100.5260206701073}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/restaurant-71.png',\n",
" 'icon_background_color': '#FF9E67',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/restaurant_pinlet',\n",
" 'name': 'Chula 50 Kitchen',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 3024,\n",
" 'html_attributions': ['Nijaya'],\n",
" 'photo_reference': 'AXCi2Q43KtNPgAsYj3abqtabmo306f1F6mGvg3x7JNpakXTc5HdNH_hfUXrbKQC7GNPlC1ddt3q5DS040foVdZh0mXeGFlSshJuawncmubGXbIR_4U9w24Ry2rQhTdy2y7ohw4zXftu4FQkHZZydD138b3d2c5_X2H_gydeQPC5XNmddfu1E',\n",
" 'width': 4032}],\n",
" 'place_id': 'ChIJcQ8J1TCZ4jARRBaANjybQI0',\n",
" 'plus_code': {'compound_code': 'PGMG+MW Bangkok',\n",
" 'global_code': '7P52PGMG+MW'},\n",
" 'price_level': 1,\n",
" 'rating': 4.1,\n",
" 'reference': 'ChIJcQ8J1TCZ4jARRBaANjybQI0',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['restaurant', 'point_of_interest', 'food', 'establishment'],\n",
" 'user_ratings_total': 831,\n",
" 'vicinity': '262 ซ. จุฬาลงกรณ์ 50 Wang Mai, Pathum Wan'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7352442, 'lng': 100.5421743},\n",
" 'viewport': {'northeast': {'lat': 13.73655452989272,\n",
" 'lng': 100.5436026298927},\n",
" 'southwest': {'lat': 13.73385487010728, 'lng': 100.5409029701073}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/restaurant-71.png',\n",
" 'icon_background_color': '#FF9E67',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/restaurant_pinlet',\n",
" 'name': 'Khrua Nai Baan',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 4032,\n",
" 'html_attributions': ['Daniel Sakariassen'],\n",
" 'photo_reference': 'AXCi2Q4wPKd0IHzNFJ_C9yYBNr71B44izssgOtFXHml92WcQWqh1Ad_LJgQx0Iq3hEMrK-IbO8aoTkrBIjbmcBVde1IX3eJEZqix5w314abVX0S1NKSZJ__jIaTHwDj3gFNYAX746On1hm9reCZ7k4jX1vpjpy8AE8oxeldIZKKCTUaC8vgF',\n",
" 'width': 3024}],\n",
" 'place_id': 'ChIJy-yYmtme4jARWdKwmvIB9Gc',\n",
" 'plus_code': {'compound_code': 'PGPR+3V Bangkok',\n",
" 'global_code': '7P52PGPR+3V'},\n",
" 'price_level': 2,\n",
" 'rating': 4.3,\n",
" 'reference': 'ChIJy-yYmtme4jARWdKwmvIB9Gc',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['meal_takeaway',\n",
" 'meal_delivery',\n",
" 'restaurant',\n",
" 'point_of_interest',\n",
" 'food',\n",
" 'establishment'],\n",
" 'user_ratings_total': 933,\n",
" 'vicinity': '90/2 ซอยหลังสวน ถนนเพลินจิต Lumphini, Pathum Wan'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7589595, 'lng': 100.5113613},\n",
" 'viewport': {'northeast': {'lat': 13.76031872989272,\n",
" 'lng': 100.5127062798927},\n",
" 'southwest': {'lat': 13.75761907010728, 'lng': 100.5100066201073}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/restaurant-71.png',\n",
" 'icon_background_color': '#FF9E67',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/restaurant_pinlet',\n",
" 'name': 'Neua Tun Nang Loeng',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 3024,\n",
" 'html_attributions': ['A Google User'],\n",
" 'photo_reference': 'AXCi2Q4cnTJBAnwz5PExJySQT1x3nq19zDiuvl_6X4FyBWn-N2ehtGkQVSNxogecgwoy2jc6M1KvcezxuZTnRb8jOrGwezXnFJ-IzziHkeXR-sbUf9hkCUvHc92zuz-fBggi5B7Pb4lguFobgvjsg_DGMaUimGU7uUBClUOdvfSRFavsW14-',\n",
" 'width': 4032}],\n",
" 'place_id': 'ChIJ35IPmECZ4jARvr7OecVtBGM',\n",
" 'plus_code': {'compound_code': 'QG56+HG Bangkok',\n",
" 'global_code': '7P52QG56+HG'},\n",
" 'price_level': 1,\n",
" 'rating': 4.6,\n",
" 'reference': 'ChIJ35IPmECZ4jARvr7OecVtBGM',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['restaurant', 'point_of_interest', 'food', 'establishment'],\n",
" 'user_ratings_total': 893,\n",
" 'vicinity': '11 Soi Nakhon Sawan 2, Wat Sommanat, Pom Prap Sattru Phai'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7461102, 'lng': 100.5236554},\n",
" 'viewport': {'northeast': {'lat': 13.74746827989272,\n",
" 'lng': 100.5249552798927},\n",
" 'southwest': {'lat': 13.74476862010728, 'lng': 100.5222556201073}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/restaurant-71.png',\n",
" 'icon_background_color': '#FF9E67',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/restaurant_pinlet',\n",
" 'name': 'Ming Phochana',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 2268,\n",
" 'html_attributions': ['Sukhum Truengtrachitkul'],\n",
" 'photo_reference': 'AXCi2Q46nTl-P1hggKf8ENqYkLYAwW60Y8IHzY2pXK2ruTO47sDLvIha217CBKi4FBla50DBltLO9xDiBebh23Pj8m-jaN-meaaAaZbD_1GfTfRQ1s943LeR_O5mVfLWn1a3_GzmD5F8XKLQa1molXYuCw9lxyelcreMDATDunylvMrqOIa9',\n",
" 'width': 4032}],\n",
" 'place_id': 'ChIJmd3lCSmZ4jARYoIvzwoxiho',\n",
" 'plus_code': {'compound_code': 'PGWF+CF Bangkok',\n",
" 'global_code': '7P52PGWF+CF'},\n",
" 'rating': 4.2,\n",
" 'reference': 'ChIJmd3lCSmZ4jARYoIvzwoxiho',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['restaurant', 'point_of_interest', 'food', 'establishment'],\n",
" 'user_ratings_total': 325,\n",
" 'vicinity': '683 ถนน บรรทัดทอง Wang Mai, Pathum Wan'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7610679, 'lng': 100.5374132},\n",
" 'viewport': {'northeast': {'lat': 13.76240467989272,\n",
" 'lng': 100.5387567298927},\n",
" 'southwest': {'lat': 13.75970502010728, 'lng': 100.5360570701073}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/restaurant-71.png',\n",
" 'icon_background_color': '#FF9E67',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/restaurant_pinlet',\n",
" 'name': 'Northeastern Thai',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 3024,\n",
" 'html_attributions': ['Tatsuya Sonnyu'],\n",
" 'photo_reference': 'AXCi2Q7eljcuPELqmpEXt3Zzv26hWczdd1DaXPNYEo8iPrFyxihqy8IssILVGliihGw0tNk8LlCp1g_gpz9oM_guRFOUoM32XZ73X_yY9odzbxK3JImr8pEmCwtEV9ckemC5mJOVum2IjOWKmQeEUZhYih8SpOymwznyevCwC3Yfb6ewf2kG',\n",
" 'width': 4032}],\n",
" 'place_id': 'ChIJZ5XY5bae4jARUv0Ljrhk2ug',\n",
" 'plus_code': {'compound_code': 'QG6P+CX Bangkok',\n",
" 'global_code': '7P52QG6P+CX'},\n",
" 'price_level': 1,\n",
" 'rating': 3.9,\n",
" 'reference': 'ChIJZ5XY5bae4jARUv0Ljrhk2ug',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['restaurant', 'point_of_interest', 'food', 'establishment'],\n",
" 'user_ratings_total': 418,\n",
" 'vicinity': 'ซอย ราชวิถี 9 Ratchawithi Rd, Thanon Phaya Thai, Ratchathewi'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.749108, 'lng': 100.5411004},\n",
" 'viewport': {'northeast': {'lat': 13.75046297989272,\n",
" 'lng': 100.5424115298927},\n",
" 'southwest': {'lat': 13.74776332010728, 'lng': 100.5397118701073}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/restaurant-71.png',\n",
" 'icon_background_color': '#FF9E67',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/restaurant_pinlet',\n",
" 'name': 'Jsuneetomyum',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 2704,\n",
" 'html_attributions': ['Colin Chow'],\n",
" 'photo_reference': 'AXCi2Q5Jz-8QSsENqYKmU5t0LdIZDjlwijo0CWAC3UqULLynj5t8O0zwg-ci9C_ilSOqSx6d6KlW1pQKAiZhc4FUyJypaA498a1BaoHF7q92uG4exWGrPi_7niGsQP16eiKdMiOkT6qW88q6X6YU5daxt3UN-P4uULMo_vU5RFRjfKoQBRrp',\n",
" 'width': 4056}],\n",
" 'place_id': 'ChIJP6dwhsWe4jARU7roepjvIqs',\n",
" 'plus_code': {'compound_code': 'PGXR+JC Bangkok',\n",
" 'global_code': '7P52PGXR+JC'},\n",
" 'price_level': 1,\n",
" 'rating': 4.4,\n",
" 'reference': 'ChIJP6dwhsWe4jARU7roepjvIqs',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['restaurant', 'point_of_interest', 'food', 'establishment'],\n",
" 'user_ratings_total': 358,\n",
" 'vicinity': '9 Ratchadamri Rd, Lumphini, Pathum Wan'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7417739, 'lng': 100.5491335},\n",
" 'viewport': {'northeast': {'lat': 13.74312892989272,\n",
" 'lng': 100.5504482798927},\n",
" 'southwest': {'lat': 13.74042927010728, 'lng': 100.5477486201073}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/restaurant-71.png',\n",
" 'icon_background_color': '#FF9E67',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/restaurant_pinlet',\n",
" 'name': 'Breakfast Story Phloen Chit',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 3024,\n",
" 'html_attributions': ['A Google User'],\n",
" 'photo_reference': 'AXCi2Q6jaFXuUBrd-rwjZaBq-PmPor4oe3j9hdgX55eWsCd27KcidJkWO6WG_8Wdq2WPTYunRRQW9UQbrh56gnoGUCLNBI5B_4mHr20Wm-ACh6J38hcVyZe5xzv_ybOCYOcmfYomH_k-NFA-j1qDoy9-anWEEP_4jXFT1-hCbMOxQpmMsbI1',\n",
" 'width': 4032}],\n",
" 'place_id': 'ChIJF5udxZSf4jARicc-U9Mo4y0',\n",
" 'plus_code': {'compound_code': 'PGRX+PM Bangkok',\n",
" 'global_code': '7P52PGRX+PM'},\n",
" 'price_level': 2,\n",
" 'rating': 4.6,\n",
" 'reference': 'ChIJF5udxZSf4jARicc-U9Mo4y0',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['restaurant',\n",
" 'cafe',\n",
" 'point_of_interest',\n",
" 'food',\n",
" 'store',\n",
" 'establishment'],\n",
" 'user_ratings_total': 1296,\n",
" 'vicinity': '888, Mahatun Plaza, 3rd Floor (above Blue Cheri, 34-35 Phloen Chit Rd, Lumphini, Pathum Wan'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7562456, 'lng': 100.5298877},\n",
" 'viewport': {'northeast': {'lat': 13.75758012989272,\n",
" 'lng': 100.5311803298927},\n",
" 'southwest': {'lat': 13.75488047010728, 'lng': 100.5284806701073}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/restaurant-71.png',\n",
" 'icon_background_color': '#FF9E67',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/restaurant_pinlet',\n",
" 'name': 'Pa Sa',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 3024,\n",
" 'html_attributions': ['A Google User'],\n",
" 'photo_reference': 'AXCi2Q6j9PuVVA5X1OhhnXBurhO1jfMccC78FMbv4hugtzE59xEZr_5YiSl4bL7tCQjwO6hQnVLkGomE8Fbzg0ezzq7n5C5hs741PIuZmvdks4dm7GRPqIgaTYvAGdIkzXoqvl_uxY0kFEuWi_hjujGoGDPIIELUGNYhRfDsyx9ANQoU2y01',\n",
" 'width': 3024}],\n",
" 'place_id': 'ChIJvTupReyf4jARinKvcO3aE-U',\n",
" 'plus_code': {'compound_code': 'QG4H+FW Bangkok',\n",
" 'global_code': '7P52QG4H+FW'},\n",
" 'rating': 4.9,\n",
" 'reference': 'ChIJvTupReyf4jARinKvcO3aE-U',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['restaurant', 'point_of_interest', 'food', 'establishment'],\n",
" 'user_ratings_total': 31,\n",
" 'vicinity': '268 Soi Phetchaburi 5, Thung Phaya Thai, Ratchathewi'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7458231, 'lng': 100.5396662},\n",
" 'viewport': {'northeast': {'lat': 13.74715152989272,\n",
" 'lng': 100.5410131298927},\n",
" 'southwest': {'lat': 13.74445187010728, 'lng': 100.5383134701073}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/restaurant-71.png',\n",
" 'icon_background_color': '#FF9E67',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/restaurant_pinlet',\n",
" 'name': 'ร้านอาหาร ฮั่วเซ่งฮง เซ็นทรัลเวิลด์ Huasenghong',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 3024,\n",
" 'html_attributions': ['A Google User'],\n",
" 'photo_reference': 'AXCi2Q7hNdxJpMaDh7sxYe_SoXQMAzC6JXRRC1MLhHoX3aHqcB5YqRLl3HcyTIhBSWm0U0mPQTI8n65dgqviIlD8e0hQHdRUqv6UgUIkti5M7ZVu-6V5NJFJRIXxpW4gSTwHSFVgd-JVoousMTg7ZQjIWOGRl7x8ZOJc6F8QfM6C-1K9Srot',\n",
" 'width': 4032}],\n",
" 'place_id': 'ChIJbXxW6M-e4jARE0x7fKFvHb4',\n",
" 'plus_code': {'compound_code': 'PGWQ+8V Bangkok',\n",
" 'global_code': '7P52PGWQ+8V'},\n",
" 'price_level': 2,\n",
" 'rating': 4.6,\n",
" 'reference': 'ChIJbXxW6M-e4jARE0x7fKFvHb4',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['restaurant', 'point_of_interest', 'food', 'establishment'],\n",
" 'user_ratings_total': 1044,\n",
" 'vicinity': '4 Ratchadamri Rd, Pathum Wan'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7612276, 'lng': 100.5156097},\n",
" 'viewport': {'northeast': {'lat': 13.76252907989272,\n",
" 'lng': 100.5170202798927},\n",
" 'southwest': {'lat': 13.75982942010728, 'lng': 100.5143206201073}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/restaurant-71.png',\n",
" 'icon_background_color': '#FF9E67',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/restaurant_pinlet',\n",
" 'name': 'Suan Sone',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 2268,\n",
" 'html_attributions': ['chanchai meeprasert'],\n",
" 'photo_reference': 'AXCi2Q4qN85hqX45mo-_4UjiW1qumiJsassfQ7EGUEh1MlpVuhwbYBB17bC1PRULq_LecHm9wHapYWbolJDamhftcC4k6ZYHN3mE0p-ty15DXiqVqwUhz_SGoXExiIMaLFoA-ASyM7M2Dc2mmpuNAO98ido7rpk-lYs99pGz6CSm8fiXEfeW',\n",
" 'width': 4032}],\n",
" 'place_id': 'ChIJDWR1VUaZ4jARUM3GyqE8vOM',\n",
" 'rating': 4.3,\n",
" 'reference': 'ChIJDWR1VUaZ4jARUM3GyqE8vOM',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['restaurant', 'point_of_interest', 'food', 'establishment'],\n",
" 'user_ratings_total': 67,\n",
" 'vicinity': 'QG68+F7J, Khwaeng Si Yaek Maha Nak, Khet Dusit'},\n",
" []]"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"def nearby_search(keyword:str, location:str, radius=2000, place_type=None):\n",
" # Retrieve the API key from environment variables\n",
" api_key = os.getenv('GPLACES_API_KEY')\n",
"\n",
" if not api_key:\n",
" raise ValueError(\"API key not found. Please set the GOOGLE_MAPS_API_KEY environment variable.\")\n",
"\n",
" # Define the endpoint URL\n",
" url = \"https://maps.googleapis.com/maps/api/place/nearbysearch/json\"\n",
"\n",
" # Set up the parameters for the request\n",
" params = {\n",
" 'keyword': keyword,\n",
" 'location': location,\n",
" 'radius': radius,\n",
" 'type': place_type,\n",
" 'key': api_key,\n",
" \"rankPreference\": \"DISTANCE\"\n",
" }\n",
"\n",
" # Send the GET request to the Google Maps API\n",
" response = requests.get(url, params=params)\n",
"\n",
" # Check if the request was successful\n",
" if response.status_code != 200:\n",
" raise Exception(f\"Error with request: {response.status_code}, {response.text}\")\n",
"\n",
" # Parse the JSON response\n",
" data = response.json()\n",
" results = data['results']\n",
"\n",
" # search into next page\n",
" while data.get('next_page_token', False):\n",
" params = {'next_page_token': data['next_page_token']}\n",
" response = requests.get(url, params=params)\n",
" \n",
" if response.status_code != 200:\n",
" raise Exception(f\"Error with request: {response.status_code}, {response.text}\")\n",
" \n",
" data = response.json()\n",
" \n",
" results.append(data['results'])\n",
" \n",
"\n",
" # Return the response data\n",
" return results\n",
"\n",
"\n",
"# Example usage\n",
"location = \"13.744677,100.5295593\" # Latitude and Longitude\n",
"keyword = \"ร้านอาหาร\"\n",
"search_results = nearby_search(keyword, location)\n",
"search_results"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[{'geometry': {'location': {'lat': 13.7563309, 'lng': 100.5017651},\n",
" 'viewport': {'northeast': {'lat': 13.9551109646008,\n",
" 'lng': 100.9384080394661},\n",
" 'southwest': {'lat': 13.4940880622837, 'lng': 100.3278135588086}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/geocode-71.png',\n",
" 'icon_background_color': '#7B9EB0',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/generic_pinlet',\n",
" 'name': 'Bangkok',\n",
" 'photos': [{'height': 934,\n",
" 'html_attributions': ['Harshvardhan Mali'],\n",
" 'photo_reference': 'AXCi2Q7_kGL2e0cJ-mzM-03YnhvWvq6hMoGHimpBUb3XMiuWbj34411Kd0GmHRI1R5GP5GdV1PZnJ7rewFeHPsQLkgLpJd0so-hweSx2XO4tL0VZL9IBi7QwGPGTDYaWuyv9EAT-ni6XEfqqfV7RGVCng7AbAxbj73FxtlNwO4u0lkvYN5Ys',\n",
" 'width': 756}],\n",
" 'place_id': 'ChIJ82ENKDJgHTERIEjiXbIAAQE',\n",
" 'reference': 'ChIJ82ENKDJgHTERIEjiXbIAAQE',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['locality', 'political'],\n",
" 'vicinity': 'Bangkok'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7431972, 'lng': 100.5301387},\n",
" 'viewport': {'northeast': {'lat': 13.7444096302915,\n",
" 'lng': 100.5314597802915},\n",
" 'southwest': {'lat': 13.7417116697085, 'lng': 100.5287618197085}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/lodging-71.png',\n",
" 'icon_background_color': '#909CE1',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/hotel_pinlet',\n",
" 'name': 'Pathumwan Princess Hotel',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 2000,\n",
" 'html_attributions': ['Pathumwan Princess Hotel'],\n",
" 'photo_reference': 'AXCi2Q738dGgO8VsMMPJueye43i4PAv2l6QcViEme2svueHmQPgpV5aRbQjsGPM_pXvUPL-FGP-EvzvPnLsUMP6qJkBKcOCgrtOvhnYU28rpq0bMQbL_pjEHCNialO3MpSiEL8rEX_uJ12W4tkLsovZ_uog_hgAd-UTO2kOaXI8gg6okv7xb',\n",
" 'width': 3000}],\n",
" 'place_id': 'ChIJFaLTtdKe4jARdKflx49LvdA',\n",
" 'plus_code': {'compound_code': 'PGVJ+73 Bangkok, Thailand',\n",
" 'global_code': '7P52PGVJ+73'},\n",
" 'rating': 4.5,\n",
" 'reference': 'ChIJFaLTtdKe4jARdKflx49LvdA',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['tourist_attraction',\n",
" 'shopping_mall',\n",
" 'lodging',\n",
" 'restaurant',\n",
" 'point_of_interest',\n",
" 'food',\n",
" 'establishment'],\n",
" 'user_ratings_total': 7801,\n",
" 'vicinity': '444 Phaya Thai Road, Khwaeng Wang Mai, Pathum Wan'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7484011, 'lng': 100.5348436},\n",
" 'viewport': {'northeast': {'lat': 13.7497612802915,\n",
" 'lng': 100.5361483302915},\n",
" 'southwest': {'lat': 13.7470633197085, 'lng': 100.5334503697085}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/lodging-71.png',\n",
" 'icon_background_color': '#909CE1',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/hotel_pinlet',\n",
" 'name': 'Siam Kempinski Hotel Bangkok',\n",
" 'photos': [{'height': 1080,\n",
" 'html_attributions': ['Siam Kempinski Hotel Bangkok'],\n",
" 'photo_reference': 'AXCi2Q4F7DywMLBgKg8B3BH8KLAXcCtLfEKiTLUVkozDhcQ14sN9BicT14YrEN9BARWKX0Xcbp85ra8kw6Qb3fL5VWvrnLB0EYWMp-a5KLUNm4vXoJnEi5gkHsSZ9BeF9LNspFKZpxgl3-IYZecw6Ahmqn7wgg2SydqGyOQGWcr6Zy7UldXP',\n",
" 'width': 1920}],\n",
" 'place_id': 'ChIJrfU90s2e4jARs0XZP2DZ4jM',\n",
" 'plus_code': {'compound_code': 'PGXM+9W Bangkok, Thailand',\n",
" 'global_code': '7P52PGXM+9W'},\n",
" 'rating': 4.7,\n",
" 'reference': 'ChIJrfU90s2e4jARs0XZP2DZ4jM',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['lodging', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 5169,\n",
" 'vicinity': '991, 9 Rama I Road, Khwaeng Pathum Wan, Pathum Wan'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7477183, 'lng': 100.5387477},\n",
" 'viewport': {'northeast': {'lat': 13.7491090802915,\n",
" 'lng': 100.5398112302915},\n",
" 'southwest': {'lat': 13.7464111197085, 'lng': 100.5371132697085}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/lodging-71.png',\n",
" 'icon_background_color': '#909CE1',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/hotel_pinlet',\n",
" 'name': 'Centara Grand & Bangkok Convention Centre at centralwOrld',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 2832,\n",
" 'html_attributions': ['Centara Grand & Bangkok Convention Centre at centralwOrld'],\n",
" 'photo_reference': 'AXCi2Q4K6AxSnn8cTJpTycj9dlIsHmaYBsMLmZ5IXU-92uE0HS2ft-o0tLltEC67tx8dk-ZdoSDGxOdRyyIYe64zNUXipMjFzxWevwk6sYlcuHINe5cH4JQNxrE7d4JTt7_BuYw2dxdoTxHZE41mZVIhQRcCe9rZ0NGTUIqoWaZf56h3w62G',\n",
" 'width': 4148}],\n",
" 'place_id': 'ChIJf1YJeC-Z4jARNNLn8M9QwMw',\n",
" 'plus_code': {'compound_code': 'PGXQ+3F Bangkok, Thailand',\n",
" 'global_code': '7P52PGXQ+3F'},\n",
" 'rating': 4.6,\n",
" 'reference': 'ChIJf1YJeC-Z4jARNNLn8M9QwMw',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['spa',\n",
" 'bar',\n",
" 'lodging',\n",
" 'restaurant',\n",
" 'point_of_interest',\n",
" 'food',\n",
" 'establishment'],\n",
" 'user_ratings_total': 6175,\n",
" 'vicinity': '999, 99 Rama I Road, Khwaeng Pathum Wan, Pathum Wan'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.750779, 'lng': 100.5306845},\n",
" 'viewport': {'northeast': {'lat': 13.7521981302915,\n",
" 'lng': 100.5321781302915},\n",
" 'southwest': {'lat': 13.7495001697085, 'lng': 100.5294801697085}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/lodging-71.png',\n",
" 'icon_background_color': '#909CE1',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/hotel_pinlet',\n",
" 'name': 'Evergreen Place Siam by UHG',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 4752,\n",
" 'html_attributions': ['Evergreen Place Bangkok'],\n",
" 'photo_reference': 'AXCi2Q5y5PY9c6Ms9F4gNYxWGejQmcK9SwjhVplXn6FUJFPYen10lEMlxWETEeIMQxkXMevlFvBQGYYdKUofi3e3p1kFOF0h9W-xtFGl5t43gbxfKQZ7db0pQ7EOXIpLyvqOGhyO5uRMADU2I3tFOOoaOTDrZYMDAA4x2XDDm-eYG8VZEAcH',\n",
" 'width': 3168}],\n",
" 'place_id': 'ChIJH2h86IGe4jARE5sKrclMXL8',\n",
" 'plus_code': {'compound_code': 'QG2J+87 Bangkok, Thailand',\n",
" 'global_code': '7P52QG2J+87'},\n",
" 'rating': 4.1,\n",
" 'reference': 'ChIJH2h86IGe4jARE5sKrclMXL8',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['lodging', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 2227,\n",
" 'vicinity': '318 Phaya Thai Road, Khwaeng Thanon Phetchaburi, Khet Ratchathewi'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7511798, 'lng': 100.5356322},\n",
" 'viewport': {'northeast': {'lat': 13.7525489802915,\n",
" 'lng': 100.5368556802915},\n",
" 'southwest': {'lat': 13.7498510197085, 'lng': 100.5341577197085}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/lodging-71.png',\n",
" 'icon_background_color': '#909CE1',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/hotel_pinlet',\n",
" 'name': 'The Residence Ratchathewi',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 1068,\n",
" 'html_attributions': ['The Residence Ratchathewi'],\n",
" 'photo_reference': 'AXCi2Q5Pz6L3evSsAtRobIq2NdAeqTMHiPvuDKrQJ64uIiHP-y_G8r8CoPetGxSRfH-BKukllETv6HqOz20SM9bK3ZBDUQQDcBzW-Es4CmuwA43j_pbfsZC-f1UytGDB29ve_2YUTFI-hT8UPe4u4skHsnAUVJvMq2hmiZDjioHVH0qlfj03',\n",
" 'width': 1600}],\n",
" 'place_id': 'ChIJx0cHr86e4jAReGZBl579QlY',\n",
" 'plus_code': {'compound_code': 'QG2P+F7 Bangkok, Thailand',\n",
" 'global_code': '7P52QG2P+F7'},\n",
" 'rating': 3.8,\n",
" 'reference': 'ChIJx0cHr86e4jAReGZBl579QlY',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['lodging', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 442,\n",
" 'vicinity': '588/1 Phetchaburi Road, Khet Ratchathewi'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7513459, 'lng': 100.5310997},\n",
" 'viewport': {'northeast': {'lat': 13.7528344302915,\n",
" 'lng': 100.5325368302915},\n",
" 'southwest': {'lat': 13.7501364697085, 'lng': 100.5298388697085}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/lodging-71.png',\n",
" 'icon_background_color': '#909CE1',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/hotel_pinlet',\n",
" 'name': 'Asia Hotel Bangkok',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 427,\n",
" 'html_attributions': ['Asia Hotel Bangkok'],\n",
" 'photo_reference': 'AXCi2Q42m_-bnKzM_8Y-hZk9z68loVfYXKFSGO6vTVf6FKy8uaRKSwXND0sGpuPHDAINcNAp_u8Yq7Gb8_P4lA75LXTi-jmWK7Gx-0o9gY2HRFKWsK-r38eqOnyv3wxZ1fz0ju2ngOxQn9N7w2m65kZSeJHNP8y8RwxH5ZsZqF5Mhei2ywew',\n",
" 'width': 640}],\n",
" 'place_id': 'ChIJH2h86IGe4jARyjZ6wppSlkQ',\n",
" 'plus_code': {'compound_code': 'QG2J+GC Bangkok, Thailand',\n",
" 'global_code': '7P52QG2J+GC'},\n",
" 'rating': 4,\n",
" 'reference': 'ChIJH2h86IGe4jARyjZ6wppSlkQ',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['lodging', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 5467,\n",
" 'vicinity': '296 Phaya Thai Road'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7497353, 'lng': 100.5403252},\n",
" 'viewport': {'northeast': {'lat': 13.7510947302915,\n",
" 'lng': 100.5419947802915},\n",
" 'southwest': {'lat': 13.7483967697085, 'lng': 100.5392968197085}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/lodging-71.png',\n",
" 'icon_background_color': '#909CE1',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/hotel_pinlet',\n",
" 'name': 'Novotel Bangkok Platinum Pratunam',\n",
" 'photos': [{'height': 4024,\n",
" 'html_attributions': ['Novotel Bangkok Platinum Pratunam'],\n",
" 'photo_reference': 'AXCi2Q5LmS7o7OSMP79lrIl2QXvnouGCkcB5sFvodYP0tc9OHRUiOuBWiTwcOMxPEqPAwEfJiHorDaVwpJtkarrfiau1zhq0NyJbvkRsrdZPy3H2oaOdZXibEDdmlk4aZFTvvrXVZYUYLhBb_SgwXiOiIUt45XsJSk6OmghS_cREKP1YhXkr',\n",
" 'width': 6048}],\n",
" 'place_id': 'ChIJN6o_Yc-e4jARBCxlg57zM4s',\n",
" 'plus_code': {'compound_code': 'PGXR+V4 Bangkok, Thailand',\n",
" 'global_code': '7P52PGXR+V4'},\n",
" 'rating': 4.4,\n",
" 'reference': 'ChIJN6o_Yc-e4jARBCxlg57zM4s',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['lodging', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 4789,\n",
" 'vicinity': '220 Phetchaburi Road'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7467415, 'lng': 100.5287877},\n",
" 'viewport': {'northeast': {'lat': 13.7480168802915,\n",
" 'lng': 100.5301780802915},\n",
" 'southwest': {'lat': 13.7453189197085, 'lng': 100.5274801197085}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/lodging-71.png',\n",
" 'icon_background_color': '#909CE1',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/hotel_pinlet',\n",
" 'name': 'MERCURE BANGKOK SIAM',\n",
" 'photos': [{'height': 768,\n",
" 'html_attributions': ['MERCURE BANGKOK SIAM'],\n",
" 'photo_reference': 'AXCi2Q7ocvEGYNG8HeCF93kfhgYGxAnaAxfpBfynwyBEBw-Oy9HXtnL878eGcHQ1MkFzA8NrCDMFkez2gWdJt5cSBD4IZHEwMU0qFDVZlMUQt7Zgx4X84-GCAreH--YSVZKf04UQBkmJcxOtkxPqf1o4E2NiTFy2FJJQNTQtwxwesRqv-hF5',\n",
" 'width': 1024}],\n",
" 'place_id': 'ChIJKS_DaA6Z4jARDH_5sbrMXfI',\n",
" 'plus_code': {'compound_code': 'PGWH+MG Bangkok, Thailand',\n",
" 'global_code': '7P52PGWH+MG'},\n",
" 'rating': 4.4,\n",
" 'reference': 'ChIJKS_DaA6Z4jARDH_5sbrMXfI',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['lodging', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 2241,\n",
" 'vicinity': '927 Rama I Road, Wangmai'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.748779, 'lng': 100.530772},\n",
" 'viewport': {'northeast': {'lat': 13.7499488302915,\n",
" 'lng': 100.5321700302915},\n",
" 'southwest': {'lat': 13.7472508697085, 'lng': 100.5294720697085}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/lodging-71.png',\n",
" 'icon_background_color': '#909CE1',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/hotel_pinlet',\n",
" 'name': 'Hua Chang Heritage Hotel',\n",
" 'photos': [{'height': 2912,\n",
" 'html_attributions': ['มิสสยาม โรงแรมหัวช้าง เฮอริเทจ'],\n",
" 'photo_reference': 'AXCi2Q7eJ-feEsa8UunCs7E5sPFynY-6jDfLmCDgRIeQ3w_7jU1Rs4JWpjbMLxkP7YasGkZzQkSH5vMcQYQf5AxFl5mRXd3kIEb9jy432P0OPAaBqt3sxZMfSKcb_B5y2VCYr0K6TQ_0MQDNshIyG0OVEjQD7J_f7GzETc5d-PCOabyWmzPj',\n",
" 'width': 4271}],\n",
" 'place_id': 'ChIJUUD5KBOZ4jAR0QLGy07t3BQ',\n",
" 'plus_code': {'compound_code': 'PGXJ+G8 Bangkok, Thailand',\n",
" 'global_code': '7P52PGXJ+G8'},\n",
" 'rating': 4.3,\n",
" 'reference': 'ChIJUUD5KBOZ4jAR0QLGy07t3BQ',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['lodging', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 1056,\n",
" 'vicinity': '400 Phaya Thai Road, Khwaeng Wang Mai, Pathum Wan'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7417243, 'lng': 100.5410489},\n",
" 'viewport': {'northeast': {'lat': 13.7429306802915,\n",
" 'lng': 100.5424668802915},\n",
" 'southwest': {'lat': 13.7402327197085, 'lng': 100.5397689197085}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/lodging-71.png',\n",
" 'icon_background_color': '#909CE1',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/hotel_pinlet',\n",
" 'name': 'Grande Centre Point Ratchadamri',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 1999,\n",
" 'html_attributions': ['Grande Centre Point Ratchadamri'],\n",
" 'photo_reference': 'AXCi2Q5Wlxtj40UeTW7ybv864ALdoitxg6X1zVEViapePtjpHmPocVAT9TpLWwgLP12pY3x9AsF6IxmE1QG5k5cLRBiJjiLikudi5Hqdh4iL7wzoeq24GDJqh53lqiITncCAz2Oi3iG18NsDvzR-9jppw2wh4N7vkTEKvBSrIyhuXwU0gs7P',\n",
" 'width': 3214}],\n",
" 'place_id': 'ChIJMckScdqe4jARnCUZdPKRjF8',\n",
" 'plus_code': {'compound_code': 'PGRR+MC Bangkok, Thailand',\n",
" 'global_code': '7P52PGRR+MC'},\n",
" 'rating': 4.5,\n",
" 'reference': 'ChIJMckScdqe4jARnCUZdPKRjF8',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['lodging', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 3963,\n",
" 'vicinity': '153, 2 Thanon Ratchadamri, Khwaeng Lumphini, Pathum Wan'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7468712, 'lng': 100.52869},\n",
" 'viewport': {'northeast': {'lat': 13.7481022302915,\n",
" 'lng': 100.5300163302915},\n",
" 'southwest': {'lat': 13.7454042697085, 'lng': 100.5273183697085}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/lodging-71.png',\n",
" 'icon_background_color': '#909CE1',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/hotel_pinlet',\n",
" 'name': 'Lub d Bangkok Siam',\n",
" 'opening_hours': {'open_now': False},\n",
" 'photos': [{'height': 4000,\n",
" 'html_attributions': ['Lub d Bangkok Siam'],\n",
" 'photo_reference': 'AXCi2Q5MgpBIfkGVqTJWhqB3_EzN6kCGdXmqjsfe22f3OygCO8QkAo-Kq7h7jNX4k6zXWjNz3CarPs6AAxhDXKn80j2uqwLXR14ABsXssWWV_ogyQPMqgEReb3bgAKcGpkkSaaWUmc-McAhW6DhW6vQZD_do1ta8scxKR_73p2q6aN6snknO',\n",
" 'width': 6000}],\n",
" 'place_id': 'ChIJc33lpDKZ4jARil4bO37UbIs',\n",
" 'plus_code': {'compound_code': 'PGWH+PF Bangkok, Thailand',\n",
" 'global_code': '7P52PGWH+PF'},\n",
" 'rating': 4.3,\n",
" 'reference': 'ChIJc33lpDKZ4jARil4bO37UbIs',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['lodging', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 938,\n",
" 'vicinity': '925, 9 Rama I Road, Khwaeng Wang Mai, Pathum Wan'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7505658, 'lng': 100.5320207},\n",
" 'viewport': {'northeast': {'lat': 13.75196523029151,\n",
" 'lng': 100.5333065302915},\n",
" 'southwest': {'lat': 13.7492672697085, 'lng': 100.5306085697085}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/lodging-71.png',\n",
" 'icon_background_color': '#909CE1',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/hotel_pinlet',\n",
" 'name': 'VIE Hotel Bangkok - MGallery',\n",
" 'photos': [{'height': 4016,\n",
" 'html_attributions': ['VIE Hotel Bangkok - MGallery'],\n",
" 'photo_reference': 'AXCi2Q7H9ekfe5SEBTgZR92yo9ZpMrNzBd-pTk4QqfhOwNowd6Yy2jVJL3nkzkPIsm-pAJ7_pDt9CuN6RTbPmknqNwCX90zhhrNH0lW2r0Qvf0D9FCifVmuQBiuiiqlaJd5jFvxAtLkhVZciK4s4atCVAsw7bzboKomd-nFwWBQjgcAFRvZc',\n",
" 'width': 6016}],\n",
" 'place_id': 'ChIJQwHqwrWe4jAR8yoMrZmtzaU',\n",
" 'plus_code': {'compound_code': 'QG2J+6R Bangkok, Thailand',\n",
" 'global_code': '7P52QG2J+6R'},\n",
" 'rating': 4.5,\n",
" 'reference': 'ChIJQwHqwrWe4jAR8yoMrZmtzaU',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['lodging', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 2350,\n",
" 'vicinity': '117 39, 40 Phaya Thai Road'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7400527, 'lng': 100.5399569},\n",
" 'viewport': {'northeast': {'lat': 13.74149933029151,\n",
" 'lng': 100.5412330302915},\n",
" 'southwest': {'lat': 13.7388013697085, 'lng': 100.5385350697085}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/lodging-71.png',\n",
" 'icon_background_color': '#909CE1',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/hotel_pinlet',\n",
" 'name': 'The St. Regis Bangkok',\n",
" 'photos': [{'height': 320,\n",
" 'html_attributions': ['The St. Regis Bangkok'],\n",
" 'photo_reference': 'AXCi2Q5UGpEywHEr-AWXukZsuPu0HB40fWZnOy8JqKPzD211vacUD-aZIe_kiLWIWtBXYGSZJhwfQiUqGRJemeenzrszfR59QRYkfjmz84yCG5E1GmuabMjKzsMz1_Xw_lEfpVjBdNVRlDCxpXBKdTWvQuirEsRNUcNV21K82YQ5uHcsVGHl',\n",
" 'width': 480}],\n",
" 'place_id': 'ChIJZ-0rstCe4jARS_6948lrmZU',\n",
" 'plus_code': {'compound_code': 'PGRQ+2X Bangkok, Thailand',\n",
" 'global_code': '7P52PGRQ+2X'},\n",
" 'price_level': 3,\n",
" 'rating': 4.6,\n",
" 'reference': 'ChIJZ-0rstCe4jARS_6948lrmZU',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['lodging', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 3162,\n",
" 'vicinity': '159 Thanon Ratchadamri, Khwaeng Lumphini, Pathum Wan'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7540569, 'lng': 100.5287023},\n",
" 'viewport': {'northeast': {'lat': 13.7554363802915,\n",
" 'lng': 100.5301208302915},\n",
" 'southwest': {'lat': 13.7527384197085, 'lng': 100.5274228697085}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/lodging-71.png',\n",
" 'icon_background_color': '#909CE1',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/hotel_pinlet',\n",
" 'name': 'Bangkok City Hotel',\n",
" 'photos': [{'height': 4032,\n",
" 'html_attributions': ['Aisyah Hassan'],\n",
" 'photo_reference': 'AXCi2Q45kObPEl9x6IgNLlnslGkXLi33hr9WfcjTzmgTgeCfbGxvW_zNbx_rKHyjYswpvV9HYuLIHqzxkIkk9HQRLNhZNo_17ev0fdIkmZ_jweiAcx0SqfUrKrNaVOzNVpCaJ1V-vZ4JEHqVpfrRp4IOMP8d7n6caqGx4UxRoxf-810nIp0l',\n",
" 'width': 3024}],\n",
" 'place_id': 'ChIJuyczxTSZ4jAR2rnUC9KTw6o',\n",
" 'plus_code': {'compound_code': 'QG3H+JF Bangkok, Thailand',\n",
" 'global_code': '7P52QG3H+JF'},\n",
" 'rating': 4,\n",
" 'reference': 'ChIJuyczxTSZ4jAR2rnUC9KTw6o',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['lodging', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 2112,\n",
" 'vicinity': '268 Phetchaburi Road, Khwaeng Thanon Phetchaburi, Khet Ratchathewi'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7455309, 'lng': 100.5198334},\n",
" 'viewport': {'northeast': {'lat': 13.7469272802915,\n",
" 'lng': 100.5214649302915},\n",
" 'southwest': {'lat': 13.7442293197085, 'lng': 100.5187669697085}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/lodging-71.png',\n",
" 'icon_background_color': '#909CE1',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/hotel_pinlet',\n",
" 'name': 'The Twin Towers Hotel',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 1335,\n",
" 'html_attributions': ['The Twin Towers Hotel'],\n",
" 'photo_reference': 'AXCi2Q4YjMQXQykJh34AvaPoQpDicrVjTTjzrvBJecemawDt8KkIs_Z0mxD3MCPlG4uf-AYgbaFjzeEfrNkwohgP6kBUC0suHCaxUpyl10shgjsJDM_XOXQdzDd0rUS7qC9gSW6zB-SPgPHHDfRPkVug5yfqwkizHwenpjW1N3oM-X5tE0l-',\n",
" 'width': 2000}],\n",
" 'place_id': 'ChIJ_zP3fy-Z4jARWYaBArPXGAg',\n",
" 'plus_code': {'compound_code': 'PGW9+6W Bangkok, Thailand',\n",
" 'global_code': '7P52PGW9+6W'},\n",
" 'rating': 4,\n",
" 'reference': 'ChIJ_zP3fy-Z4jARWYaBArPXGAg',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['lodging', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 3327,\n",
" 'vicinity': '88 ถ.พระราม 6 ตัดใหม่, Khwaeng Rong Muang, Pathum Wan'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7408604, 'lng': 100.5399556},\n",
" 'viewport': {'northeast': {'lat': 13.74230515, 'lng': 100.5413903802915},\n",
" 'southwest': {'lat': 13.73950815, 'lng': 100.5386924197085}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/lodging-71.png',\n",
" 'icon_background_color': '#909CE1',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/hotel_pinlet',\n",
" 'name': 'Anantara Siam Bangkok Hotel',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 1037,\n",
" 'html_attributions': ['Anantara Siam Bangkok Hotel'],\n",
" 'photo_reference': 'AXCi2Q6DA5mxxuCojam3qIVtDhVIufnit8nOdnBzNqRqLhIhFSY4_e4GpOeCmHG-ceoy_647k8vekQNQgamq-uc78e7tqpmg-LJl1yx2eS9rRQOJfpKvjpzH_2uokvqdpXA9DQnxdrDAJ4VnQysUPmHEZ7VyLV974wbyhAIIFEk7xrnamr55',\n",
" 'width': 1920}],\n",
" 'place_id': 'ChIJVwz7GcWe4jARatGDB6rxqcE',\n",
" 'plus_code': {'compound_code': 'PGRQ+8X Bangkok, Thailand',\n",
" 'global_code': '7P52PGRQ+8X'},\n",
" 'rating': 4.6,\n",
" 'reference': 'ChIJVwz7GcWe4jARatGDB6rxqcE',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['spa',\n",
" 'lodging',\n",
" 'restaurant',\n",
" 'point_of_interest',\n",
" 'food',\n",
" 'establishment'],\n",
" 'user_ratings_total': 5377,\n",
" 'vicinity': '155 Rajadamri Road, Khwaeng Lumphini, Pathum Wan'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7468291, 'lng': 100.5313447},\n",
" 'viewport': {'northeast': {'lat': 13.7480164802915,\n",
" 'lng': 100.5327981302915},\n",
" 'southwest': {'lat': 13.7453185197085, 'lng': 100.5301001697085}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/shopping-71.png',\n",
" 'icon_background_color': '#4B96F3',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/shopping_pinlet',\n",
" 'name': 'Siam Discovery',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 3024,\n",
" 'html_attributions': ['Frank Roggenbuck'],\n",
" 'photo_reference': 'AXCi2Q4hBMmWnQK87L6UuPTafdG6LFOQ-5_D2wCMQfuuRlZzXnllBBHrWsj6GNygb8opBntWSIuLsbqD8hm8Ysig01bnC83ZObM6c8yb6iG-JuhLnbY9YPu68nIFHvn4HwzpbjHI5ou7TsblB8Ayy7GxlLSNSfC_SIp08FoFTnRHdBUchW7U',\n",
" 'width': 4032}],\n",
" 'place_id': 'ChIJgUSJZM2e4jAREnHS1rSuWRk',\n",
" 'plus_code': {'compound_code': 'PGWJ+PG Bangkok, Thailand',\n",
" 'global_code': '7P52PGWJ+PG'},\n",
" 'rating': 4.4,\n",
" 'reference': 'ChIJgUSJZM2e4jAREnHS1rSuWRk',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['shopping_mall', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 18880,\n",
" 'vicinity': '194 Phaya Thai Road, Khwaeng Pathum Wan, Pathum Wan'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7481275, 'lng': 100.5414289},\n",
" 'viewport': {'northeast': {'lat': 13.7494722302915,\n",
" 'lng': 100.5427770802915},\n",
" 'southwest': {'lat': 13.7467742697085, 'lng': 100.5400791197085}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/lodging-71.png',\n",
" 'icon_background_color': '#909CE1',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/hotel_pinlet',\n",
" 'name': 'Aphrodite Inn Bangkok',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 1280,\n",
" 'html_attributions': ['Aphrodite Inn Bangkok'],\n",
" 'photo_reference': 'AXCi2Q7E0E5BBArQzjVc3z_jCSpTLGBrxpdfOZsR6-mzRE4QisOkBt99tWKFXYuszidfLskO0BdPipyynuRoVKPE5rjYpX0bCZ1Xq5MAyC5fyQgnROGKNKfy3YooEvYnE6wJRg44wvzwMggzLOO2bsDwHe4XUU4rDWEOwWzCbTh4MFYLOveT',\n",
" 'width': 1280}],\n",
" 'place_id': 'ChIJJ-xLecWe4jARimHRYcEPNS8',\n",
" 'plus_code': {'compound_code': 'PGXR+7H Bangkok, Thailand',\n",
" 'global_code': '7P52PGXR+7H'},\n",
" 'rating': 4.3,\n",
" 'reference': 'ChIJJ-xLecWe4jARimHRYcEPNS8',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['lodging', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 204,\n",
" 'vicinity': '61-65 Thanon Ratchadamri, ลุมพินี, Pathum Wan'},\n",
" {'geometry': {'location': {'lat': 13.746183, 'lng': 100.5307787},\n",
" 'viewport': {'northeast': {'lat': 13.75307941101843,\n",
" 'lng': 100.5529221455833},\n",
" 'southwest': {'lat': 13.72275417223182, 'lng': 100.5156772173436}}},\n",
" 'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/geocode-71.png',\n",
" 'icon_background_color': '#7B9EB0',\n",
" 'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/generic_pinlet',\n",
" 'name': 'Pathum Wan',\n",
" 'photos': [{'height': 1800,\n",
" 'html_attributions': ['Nakorn Chong'],\n",
" 'photo_reference': 'AXCi2Q7B7dt3IZdJhvN9lmU8z_aymle84eBpGNAajDMwS_uTbUun0jW1KWakdwuRD9JQ-U2WQs8X0I0H_OmO7cCQp57VbTPoblxl2qtEPmXH2YwQezlJ_Mym4TJqc9sgfj1TaGsYArLGej_by5wPvZfGwJdBnEoN2HLOfp6HN58sNlccFxTM',\n",
" 'width': 4000}],\n",
" 'place_id': 'ChIJ9dY-MdSe4jAR8E3iXbIAAQM',\n",
" 'reference': 'ChIJ9dY-MdSe4jAR8E3iXbIAAQM',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['sublocality_level_1', 'sublocality', 'political'],\n",
" 'vicinity': 'Pathum Wan'}]"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"def nearby_dense_community(location:str, radius:int=2000):\n",
" # Retrieve the API key from environment variables\n",
" api_key = os.getenv('GPLACES_API_KEY')\n",
"\n",
" if not api_key:\n",
" raise ValueError(\"API key not found. Please set the GOOGLE_MAPS_API_KEY environment variable.\")\n",
"\n",
" # Define the endpoint URL\n",
" url = \"https://maps.googleapis.com/maps/api/place/nearbysearch/json\"\n",
"\n",
" # Set up the parameters for the request\n",
" params = {\n",
" \"includedTypes\": [\"hotel\", \"mall\", \"school\", \"apartment\"],\n",
" 'location': location,\n",
" 'radius': radius,\n",
" 'key': api_key,\n",
" \"rankPreference\": \"DISTANCE\"\n",
" }\n",
"\n",
" # Send the GET request to the Google Maps API\n",
" response = requests.get(url, params=params)\n",
"\n",
" # Check if the request was successful\n",
" if response.status_code != 200:\n",
" raise Exception(f\"Error with request: {response.status_code}, {response.text}\")\n",
"\n",
" # Parse the JSON response\n",
" data = response.json()\n",
" results = data['results']\n",
"\n",
" # Return the response data\n",
" return results\n",
"\n",
"\n",
"location = \"13.744677,100.5295593\" # Latitude and Longitude\n",
"search_results = nearby_dense_community(location)\n",
"search_results"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
}
},
"nbformat": 4,
"nbformat_minor": 2
}