{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import requests"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import utils\n",
"\n",
"utils.load_env()"
]
},
{
"cell_type": "code",
"execution_count": 3,
"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. 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\\n4. Central Department Store Fashion Island\\nAddress: 591 Ram Inthra Rd, Khwaeng Khan Na Yao, Khet Khan Na Yao, Krung Thep Maha Nakhon 10230, Thailand\\nGoogle place ID: ChIJU51oO09jHTERkAkthlfrvMQ\\nPhone: 02 947 5320\\nWebsite: http://www.central.co.th/\\n\\n\\n5. 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\\n6. 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\\n7. 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\\n8. 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\\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. HomePro Fashion Island\\nAddress: 589, 10 Ram Inthra Rd, Khwaeng Khan Na Yao, Khet Khan Na Yao, Krung Thep Maha Nakhon 10230, Thailand\\nGoogle place ID: ChIJEyIpYLBjHTERibQeHSiSERE\\nPhone: 02 029 7700\\nWebsite: https://lin.ee/nfKDS60\\n\\n\\n13. Bake a Wish (Fashion Island)\\nAddress: ชั้น B, Fashion Island, 587 Ram Inthra Rd, รามอินทรา, Khet Khan Na Yao, Krung Thep Maha Nakhon 10230, Thailand\\nGoogle place ID: ChIJfyU40Q5jHTERTKLwRhRWk-o\\nPhone: 064 121 7146\\nWebsite: Unknown\\n\\n\\n14. Opposite Fashion Island\\nAddress: Khan Na Yao, Bangkok 10230, Thailand\\nGoogle place ID: ChIJV8YMrwhjHTERTd8eEupPwZY\\nPhone: Unknown\\nWebsite: Unknown\\n\\n'"
]
},
"execution_count": 3,
"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": 4,
"metadata": {},
"outputs": [],
"source": [
"#find places id\n",
"#near by search"
]
},
{
"cell_type": "code",
"execution_count": 5,
"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": 6,
"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": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[{'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7351837, 'lng': 100.5273717},\n",
" 'viewport': {'northeast': {'lat': 13.73656872989272,\n",
" 'lng': 100.5287270298927},\n",
" 'southwest': {'lat': 13.73386907010728, 'lng': 100.5260273701073}}},\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': 'Tan Kun',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 590,\n",
" 'html_attributions': ['A Google User'],\n",
" 'photo_reference': 'AelY_CuB4olrTHjZNP0mHiQYEtk9VzeCjJpkFRtZWbgVN7foW84PKitEI6vSr8UKsGR9N7uuJx0BZUhVtPM0BaFJZ1hSkNdASQEUUgyWI-CHMfqXhTe8MMkvQ2d5niGHZBYDs6a0gdxCU8YatZFE5ha8Hwh_OZnvxgpzx2aPYBcFkWaPmtPA',\n",
" 'width': 1050}],\n",
" 'place_id': 'ChIJJ4Ag2oWZ4jARUe4JGpj8d2U',\n",
" 'plus_code': {'compound_code': 'PGPG+3X Bangkok',\n",
" 'global_code': '7P52PGPG+3X'},\n",
" 'rating': 4.7,\n",
" 'reference': 'ChIJJ4Ag2oWZ4jARUe4JGpj8d2U',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['restaurant', 'food', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 2523,\n",
" 'vicinity': '198 Alley, Wang Mai, Pathum Wan'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7462054, 'lng': 100.5236458},\n",
" 'viewport': {'northeast': {'lat': 13.74756192989272,\n",
" 'lng': 100.5249427798927},\n",
" 'southwest': {'lat': 13.74486227010728, 'lng': 100.5222431201073}}},\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': 'ร้านอาหาร แหลกไม่แหลก Laekmailaek 东北辣味-',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 3840,\n",
" 'html_attributions': ['Piyapong Wangthamrongwit'],\n",
" 'photo_reference': 'AelY_Cv-u34NZzjOL7nIiSgeyK728TRSuEJmAtz78Exn0q8rEoaEJCcfSGikSaJY2-RwzZIkTfcgAMJytBPIyPbcF6UzqSViMAnu2V60LFj2J9jGtpwl1mxpDvW4hiEQqZJ8HJJeTPWF-Ly04mMys-xCQr_Go53C7nGxo27D2LTppJYozjQ',\n",
" 'width': 5120}],\n",
" 'place_id': 'ChIJ6YExxNqZ4jAR3xr0u1g1Cfg',\n",
" 'plus_code': {'compound_code': 'PGWF+FF Bangkok',\n",
" 'global_code': '7P52PGWF+FF'},\n",
" 'price_level': 2,\n",
" 'rating': 4.8,\n",
" 'reference': 'ChIJ6YExxNqZ4jAR3xr0u1g1Cfg',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['restaurant', 'food', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 142,\n",
" 'vicinity': 'หมู่บ้าน โครงการ staduim one เลขที่ 675 ซอย จุฬา6 Wang Mai, Pathum Wan'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7461111, 'lng': 100.5341667},\n",
" 'viewport': {'northeast': {'lat': 13.74737902989272,\n",
" 'lng': 100.5353600298927},\n",
" 'southwest': {'lat': 13.74467937010728, 'lng': 100.5326603701073}}},\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': 'Oishi Grand',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 3180,\n",
" 'html_attributions': ['Annsophita'],\n",
" 'photo_reference': 'AelY_CuvmsgiFWnr2514iAEcijPhx2RYAx9CSIK-q9odikWcGMZIpf6DLpzqpB66IlFvDjlxGT-Rudw87FL4zrPVxVOZAmdQvPaHJJvxHf14nhT2iTI2mgBz5pin-Ga0kzQ175nuTvxCtyjLi8V0a9Hl47eXUsQbFzGY8JAYrLYz_YSTii-1',\n",
" 'width': 4966}],\n",
" 'place_id': 'ChIJgxYz9M2e4jARrtIRIYw7VpY',\n",
" 'plus_code': {'compound_code': 'PGWM+CM Bangkok',\n",
" 'global_code': '7P52PGWM+CM'},\n",
" 'price_level': 3,\n",
" 'rating': 4.1,\n",
" 'reference': 'ChIJgxYz9M2e4jARrtIRIYw7VpY',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['restaurant', 'food', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 836,\n",
" 'vicinity': 'เลขที่ห้อง 423B ชั้น 4 เลขที่ , 991 Rama I Rd, 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': 'AelY_CtJxUlAIxkCliCEeZroqmfaW1NV5sG5KTyBpxJR-_S-mvyzWK7SMcfml6DX7OCUT1TayJZDNlwTurEa7kcnrLy0K8tb6LC9K6bT7wuSH9O76W5TgiEcW6LFGXpCc3nK04bDKB_4bCpIp88pyzy4bLDFS3J5QRZyS4uXQQToNbcIQPN3',\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', 'food', 'point_of_interest', '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.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': 'AelY_Cs5SMb9y-z3cyzTBMjBNYXaliHPG-NifsmtGXd7QnQ60DPG23EpFw2HqI9h8s0OoHFoqWs8DdyJSRghqBkvugmYxgGyufBNOSxhQSovngZYsoYXw-s3MPqKlkT-Qel-mmWMdos52BcR0Z7m6Omyu0HSWJCbQalVCTKPiKsGo-pVj2ij',\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_delivery',\n",
" 'meal_takeaway',\n",
" 'restaurant',\n",
" 'food',\n",
" 'point_of_interest',\n",
" 'establishment'],\n",
" 'user_ratings_total': 933,\n",
" 'vicinity': '90/2 ซอยหลังสวน ถนนเพลินจิต Lumphini, Pathum Wan'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.747069, 'lng': 100.5106393},\n",
" 'viewport': {'northeast': {'lat': 13.74842532989272,\n",
" 'lng': 100.5119918298927},\n",
" 'southwest': {'lat': 13.74572567010728, 'lng': 100.5092921701073}}},\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': 'Aroy Rim Tang',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 3024,\n",
" 'html_attributions': ['Patt Ch'],\n",
" 'photo_reference': 'AelY_Cv5vy5NIRuWSQgUIVl9uexxMt0Uyn_YgdFiYqJTdm9yHAOhgx2BEdXn-DWkMUjypxiNtSx7-V5n0YwSPol2gz86CmGAQIk3M3q4Z0ILTKDSAjmiZ5_HuADhXuigyZdkWhccQfNTwOe2kdWWtu-XsAwiPBHq60eYCY1_EWJVaSaoJGNr',\n",
" 'width': 4032}],\n",
" 'place_id': 'ChIJMz6-zTyZ4jARhZlPwWu2p2Q',\n",
" 'plus_code': {'compound_code': 'PGW6+R7 Bangkok',\n",
" 'global_code': '7P52PGW6+R7'},\n",
" 'rating': 4.4,\n",
" 'reference': 'ChIJMz6-zTyZ4jARhZlPwWu2p2Q',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['restaurant', 'food', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 270,\n",
" 'vicinity': '389 391 Yukol 2 Rd, Wat Thep Sirin, Pom Prap Sattru Phai'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7396982, 'lng': 100.5134399},\n",
" 'viewport': {'northeast': {'lat': 13.74098412989272,\n",
" 'lng': 100.5147391298927},\n",
" 'southwest': {'lat': 13.73828447010728, 'lng': 100.5120394701073}}},\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': 'Tae Jeaw Cuisine',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 2736,\n",
" 'html_attributions': ['Tony Tan Hooi Tong'],\n",
" 'photo_reference': 'AelY_CtQWuVhEp_XrKWRklk7MHJLJ_TlxqStp_oDrMW1WThyRs7Ud4w1EIKZoMK_W7K20FCIFrneqMk51ONs0ZGcbYj-Zkw-vWCntJZXrWHgQtL5XRGIWpWkSw99WdfUuVaKjUC54JgyXsqN1cJ9gF41UGT3XD1JrPHhPjK2z2S8AJatuovM',\n",
" 'width': 3648}],\n",
" 'place_id': 'ChIJ61kXOiGZ4jARg4ZDvWQBQDg',\n",
" 'plus_code': {'compound_code': 'PGQ7+V9 Bangkok',\n",
" 'global_code': '7P52PGQ7+V9'},\n",
" 'price_level': 2,\n",
" 'rating': 4.1,\n",
" 'reference': 'ChIJ61kXOiGZ4jARg4ZDvWQBQDg',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['restaurant', 'food', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 422,\n",
" 'vicinity': '69-71 Rama IV Rd, Pom Prap, 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': 'AelY_Cs4iSMYZ4yCbC8kZtB7kazcOmxER0rkiquNyA_5cYE81qp3un3c9YbV38nShjxnu_HGkeEVtCea2j-bKx46AYl9KvM_kesbIayGQGZNtvASUjCQHRtoRhrvBmYZnj-zzz444TWxbIH0wqN6O0EmEIZc8q5YoKw2R6GrB4RMozr2y2tI',\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', 'food', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 325,\n",
" 'vicinity': '683 ถนน บรรทัดทอง Wang Mai, Pathum Wan'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7353071, 'lng': 100.5245077},\n",
" 'viewport': {'northeast': {'lat': 13.73665022989272,\n",
" 'lng': 100.5258982798927},\n",
" 'southwest': {'lat': 13.73395057010728, 'lng': 100.5231986201073}}},\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': 'Kumpoy',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 2449,\n",
" 'html_attributions': ['A Google User'],\n",
" 'photo_reference': 'AelY_CuHw88RVqF7nj6zEZSuUmW-X8xSF0SQRvJzpn5cRxqXKTDFTzMPs7bJoUTwmefrI9oEis6bcL8l-2JMvzBTCIe4aaEpThrtT2TmwZEPCeyOgoUcTL8ULETLAcQiSKzYu-IdSLC7O54eGITeHMa_4W808bNRVkIZVwX0QYF0Y1SxAI97',\n",
" 'width': 3265}],\n",
" 'place_id': 'ChIJORR7LH-Z4jARm6CfzH5ydp4',\n",
" 'plus_code': {'compound_code': 'PGPF+4R Bangkok',\n",
" 'global_code': '7P52PGPF+4R'},\n",
" 'rating': 4.8,\n",
" 'reference': 'ChIJORR7LH-Z4jARm6CfzH5ydp4',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['restaurant', 'food', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 274,\n",
" 'vicinity': 'อาคาร G ห้อง G109 เลขที่ 394 โครงการ Block 28 ซอย จุฬา 7 Wang Mai, Pathum Wan'},\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': 'AelY_Cth5MJOAFMOzZrygzSJuXmSdUJntRLmms5MdBADHmK6KJZ-HbC9090YSlPt9UVaK3cm4EvDHwMAQKBsBcr8dVYXCM2jIVMmNdyGnrWigTczY7CFpiGdkV6ch9YZP7aKtECKJ8Kvu_vSXm4VFRTAbB6r85NiVFhgnxQINKQvpamkYKE9',\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', 'food', 'point_of_interest', '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.7270214, 'lng': 100.5417728},\n",
" 'viewport': {'northeast': {'lat': 13.72837922989272,\n",
" 'lng': 100.5431133298927},\n",
" 'southwest': {'lat': 13.72567957010728, 'lng': 100.5404136701073}}},\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': 'The Meatchop Butcher & Spirits',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 2268,\n",
" 'html_attributions': ['Jacqueline Chang'],\n",
" 'photo_reference': 'AelY_CsL6kTrUiiiG557nz5ISr2eTbfh2Z0kkGLjD_cvbW61SuoGyWY3KP-q4nLzst9IQVzus5jkB7wi-x7SScniNRbOF-T8LWmMPNDNDTlo-D0Vt2Gb-40FrMpj5Epdz5iw0EHtabQB-WaIf3cdJ4QiQJJmebNBPhPN0qiVGNsozUTWxLPm',\n",
" 'width': 4032}],\n",
" 'place_id': 'ChIJT-oxkyWf4jARUeH8Uz2J_to',\n",
" 'plus_code': {'compound_code': 'PGGR+QP Bangkok',\n",
" 'global_code': '7P52PGGR+QP'},\n",
" 'rating': 4.6,\n",
" 'reference': 'ChIJT-oxkyWf4jARUeH8Uz2J_to',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['bar', 'restaurant', 'food', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 431,\n",
" 'vicinity': '1, 4 Sala Daeng Rd, Silom, Bang Rak'},\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': 'AelY_CvU8trVYCKQAuaATdq5qJSvqDlvzZCgU7Y07DT44UL7o7L-zabv3E4Reb3HL3I_95fJqAy6yJvZOV4LOeNG0eRcicM3FHPOWQp0FUSPdGpVmlMGiE8BwowfD_drd_oS2wrpumk_IW_lXkSKuYVXihgudT4VYulESOqj8H4HQklY5hqZ',\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', 'food', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 418,\n",
" 'vicinity': 'ซอย ราชวิถี 9 Ratchawithi Rd, Thanon Phaya Thai, Ratchathewi'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7287027, 'lng': 100.5159435},\n",
" 'viewport': {'northeast': {'lat': 13.73004417989272,\n",
" 'lng': 100.5172275798927},\n",
" 'southwest': {'lat': 13.72734452010728, 'lng': 100.5145279201073}}},\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': 'New Heng Kee',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 1440,\n",
" 'html_attributions': ['Bee Tirawit'],\n",
" 'photo_reference': 'AelY_CtBf8b3_pKkS__bGdfxtM9DhAnt8Fc9215LhysXLiNauGldvfyRAMipU4VDNTOMZ_pYu7-nv4nLn8LsQM_DeD7TjbkapXEzAsPURs92op3VF2Ucw7moNTT7vpH1M50dTtiblRIa7UWJ-iRlD-PojyKGp5dgVO_4GTZu8aC0Df7VUyFJ',\n",
" 'width': 1920}],\n",
" 'place_id': 'ChIJZS6AR9qY4jARsKu9BTfH0xE',\n",
" 'plus_code': {'compound_code': 'PGH8+F9 Bangkok',\n",
" 'global_code': '7P52PGH8+F9'},\n",
" 'price_level': 1,\n",
" 'rating': 4.4,\n",
" 'reference': 'ChIJZS6AR9qY4jARsKu9BTfH0xE',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['restaurant', 'food', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 347,\n",
" 'vicinity': '1079 ติดริมถนนใหญ่ ฝั่งขวามือ อยู่ระหว่างซอยเจริญกรุง 41 และ 39 Si Phraya, Bang Rak'},\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': 'AelY_Ctn9-5ky7fFbQG5lS-JVFUxsznoApOPFgSFwtnWWKugmYgvUhfnalTe_L52eYEMw-W3appj5T2LQHrVE30qPP7mpA3opWLnDpuEt8krNk3kyrcWT3-Y2GPSpiZh0jHpIQY2yb58bYTlvvlfvf9fwozDPayp5zQgSkiW5SENuyQ-lS9X',\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', 'food', 'point_of_interest', '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.7269958, 'lng': 100.5406399},\n",
" 'viewport': {'northeast': {'lat': 13.72855587989272,\n",
" 'lng': 100.5420766298927},\n",
" 'southwest': {'lat': 13.72585622010728, 'lng': 100.5393769701073}}},\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': 'ข้าวแกงเฮียเพ้ง สาขา อื้อจือเหลียง',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 852,\n",
" 'html_attributions': ['A Google User'],\n",
" 'photo_reference': 'AelY_CuHZ77SBqcTXxG9Q4uoiGWTCVHQxgwNYbkCSgJugHi-_MlzunXVmQb9viC6sTEn6hEBSwCvUhcbcZyW3cX2QvrbxsCNKrOhyIaFJPqurK61g3_SB-LHoPbtfxghMBkiu0Fh0-AwIjYhifIhaj9DsYl9zELoaZZ_pSVIRCF5FPP0btve',\n",
" 'width': 1280}],\n",
" 'place_id': 'ChIJqxjCoZSf4jARFB24xaFCc00',\n",
" 'plus_code': {'compound_code': 'PGGR+Q7 Bangkok',\n",
" 'global_code': '7P52PGGR+Q7'},\n",
" 'rating': 4.6,\n",
" 'reference': 'ChIJqxjCoZSf4jARFB24xaFCc00',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['restaurant', 'food', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 27,\n",
" 'vicinity': 'U Chu Ling Building, ชั้น 1, Rama IV Rd, Bang Rak'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.759169, 'lng': 100.5418982},\n",
" 'viewport': {'northeast': {'lat': 13.76047452989272,\n",
" 'lng': 100.5432265798927},\n",
" 'southwest': {'lat': 13.75777487010728, 'lng': 100.5405269201073}}},\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 Ajarn Thai Restaurant',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 3000,\n",
" 'html_attributions': ['Patnalin Ward'],\n",
" 'photo_reference': 'AelY_CtKhNzveiXwceJVdGCs-UmYf5-n63K9rEkoUo7eGHqwwszQh5_dR6q17hHy4IBPjEfb322jINtW_ny-mzoVfO1tHIMI6yyoOdRg-y-vIgFsAIMszTa654l0lT7vV--ds1AQRxPCxp9uV5YvC6JMm6WVZODYGsSKYu9wpfqHwPXnGJM9',\n",
" 'width': 5333}],\n",
" 'place_id': 'ChIJwVEDWFqY4jARsSm0XUwLXlQ',\n",
" 'plus_code': {'compound_code': 'QG5R+MQ Bangkok',\n",
" 'global_code': '7P52QG5R+MQ'},\n",
" 'rating': 4.3,\n",
" 'reference': 'ChIJwVEDWFqY4jARsSm0XUwLXlQ',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['restaurant', 'food', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 430,\n",
" 'vicinity': '107/7-8 Rang Nam Alley, Thanon Phaya Thai, Ratchathewi'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7559693, 'lng': 100.5331709},\n",
" 'viewport': {'northeast': {'lat': 13.75730842989272,\n",
" 'lng': 100.5345377798927},\n",
" 'southwest': {'lat': 13.75460877010728, 'lng': 100.5318381201073}}},\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': 'Grandma Pen Pad Thai',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 3024,\n",
" 'html_attributions': ['Ban vachala'],\n",
" 'photo_reference': 'AelY_Culoc-XCLBxUB7INjnVZItVSNkb4CnXLGLLfj2RcdY75Ham0IrY8SxcvUbpEd8mHh42q4-afvCgrMd5n6hG0PYikTEkG-EY5LpQHd9m_Hv80Wd7UcKUbf6btyTUoNjQjaUHRsZ_ze06NVSJfFx02hgCwXdfAMPb6YnSUijNhfwRXFZM',\n",
" 'width': 4032}],\n",
" 'place_id': 'ChIJQdQaAcue4jAROAPoW54g6oc',\n",
" 'plus_code': {'compound_code': 'QG4M+97 Bangkok',\n",
" 'global_code': '7P52QG4M+97'},\n",
" 'rating': 4.7,\n",
" 'reference': 'ChIJQdQaAcue4jAROAPoW54g6oc',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['restaurant', 'food', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 41,\n",
" 'vicinity': '130 2 หน้าตึกพญาไทพลาซ่า BTSพญาไท Phaya Thai Rd, Thung Phaya Thai, Ratchathewi'},\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': 'AelY_CtXzfh2yMnQhWboymflkX362ba72aC5lxfzsdOfj0JAJWZXlsU-VyjG83IwO3oneyFJ1OR2NiyQ9tXvSvcSMqOt2i4INM12GqlQaCEY98SvtOCdIq-_HyBxuQg58NlXUzjOZuZV3jMQuhMtI6Dcc-lwQsGZLv4DuZGT46zqRLERdFut',\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",
" 'food',\n",
" 'point_of_interest',\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.7280186, 'lng': 100.5187055},\n",
" 'viewport': {'northeast': {'lat': 13.72936362989272,\n",
" 'lng': 100.5200147798927},\n",
" 'southwest': {'lat': 13.72666397010728, 'lng': 100.5173151201073}}},\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': 'อิ่มอร่อย @ มหาเศรษฐ์ Aim Aroi @ Mahaset',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 1537,\n",
" 'html_attributions': ['A Google User'],\n",
" 'photo_reference': 'AelY_Csx7CmDhDQ-JgTlruJS5ZmjJodJS7Dx8_gYcpWnJLuBhjgAltenzV8mlqCX8-XNR3AN_p0doFz1Bp9t9P1cIIeC5law5cjmwio0sTg9OWJfwfy_I76eLRuEn1iN1TDFvH18mI3xEODNZ3-8WChFEvqefTUpvqOkiSfwJzq8rRqgAYWS',\n",
" 'width': 2048}],\n",
" 'place_id': 'ChIJB7tcm7qZ4jAR1jSaNTs97gA',\n",
" 'plus_code': {'compound_code': 'PGH9+6F Bangkok',\n",
" 'global_code': '7P52PGH9+6F'},\n",
" 'rating': 4.5,\n",
" 'reference': 'ChIJB7tcm7qZ4jAR1jSaNTs97gA',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['restaurant', 'food', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 67,\n",
" 'vicinity': '39 Maha Set Rd, Khwaeng Si Phraya, Bang Rak'},\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': 'AelY_CveOueRh8vWnFQ9Vkk0Po1D83PUmrmg8dS4zCan5txTjPIgk3Lmijsn1zOnmXDMqA-N5J2U9zWatx64FqYNWXFCl0LAnWod2mtT7w3gDxRTTzMlXcFkF45dNMC17fqAhQnsNecwEiXzi6WAfNJ5Nu7UB9G0GHbEi8TeY6hbJW27YUtl',\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', 'food', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 63,\n",
" 'vicinity': '190 3 ถนน พญาไท Khwaeng Makkasan, Ratchathewi'}]"
]
},
"execution_count": 7,
"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",
"\n",
" # Return the response data\n",
" return data['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"
]
}
],
"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
}