{
"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. 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. 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\\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. Panya Ramintra\\nAddress: Khan Na Yao, Bangkok 10230, Thailand\\nGoogle place ID: ChIJ9e97xwhjHTERR-MWDuKtUYY\\nPhone: Unknown\\nWebsite: Unknown\\n\\n\\n9. Manfair @Fashion Island, 2nd FL, Street 23, Grand Station, Unit MSE025\\nAddress: Manfair Store-Grand Station @Fashion Island Khwaeng Khan Na Yao, Khet Khan Na Yao, Krung Thep Maha Nakhon 10230, Thailand\\nGoogle place ID: ChIJod6zSApjHTERkZ8GxIKx-AY\\nPhone: 085 166 5561\\nWebsite: https://manfair.co.th/\\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. 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\\n12. 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\\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. 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\\n15. 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": 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": 43,
"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": 45,
"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': 'AelY_CsoE9mkGAM4CG4Y7i3QaoX7aKQZy9HhsBI-v4gCECbwhKH5_r-0_gCdsvjSgGyjxX5MKn5_pLdTgHTESSCsFLHYWvsPCdBhNLEAipvg7fS82FL3__FnHBVkM_ufpYlHCCn57kf8b_7EazaR1rvLXoaGY6jRZ5fCEUaY9CtfBqZqbxk',\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', 'food', 'point_of_interest', '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': ['auttapong maesincee'],\n",
" 'photo_reference': 'AelY_Cuw4CTnO_tRSofR-FyQfj8EB2EiuNd5M0rdo1LBY-WzlDt0COUJLVdya639XsDmqeXaEXDsuHPe8lQy2uj3REGHCK0rj9RBXEwcclMdKZLFwmy2MHkel4MoxAg5QSjimam-OuiUql3xfdVwVI_p95eTNoAWBkHCyAPyEw_ILsPz3xO5',\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', 'food', 'point_of_interest', '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': 'AelY_Cve0Z3K2wpXgtc9uyyRNmUaQEsNrxCjnkKphKCd534mIu2LnYccgRFjTfFBjBOMI7FohPZGjIS1_iNFy1atfgkos24-Oz1yMbRFsfngUWMnVfoMMYySuhMPMj5H-KZSOEgzrjS93tLDdOvjSG-ooMXCby8udoXmRDf8cjGbIudJt_Ef',\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': 64,\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': 'AelY_Cv4WhdIzv_rZWGAOHk3MDedYk69pG-sj3gRLSXIstV9JBPQdKqYQNll6o9E2_-j0tHbljoMdnVi1VGlajxPzjT1ONP10NmNpfwTbIJuntKw6fwJPTsYCak1ZooXO1gQKmzPWBcNwHkE8sshXwgrwYaNQ8AahF8ZGvLd14W5WQ8MpbtF',\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': 39,\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': 'AelY_Cso_rentogXMdMZUgmkkRmY9-Wq14vmpmO758LJqvyxfsUzXMv98HID9tluoKllNnUMxRDxfSsPR7HBdXhj_bAYXLY8gKe8txNRix4Sbj7I-EG4jbgPItvJP-9BMxMdpgU6D2ZpBypvLssziSkv1l3LqigPovW0rUqqt3ZnM803GLQr',\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.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': 'AelY_CuAScQz_jbH-RnBWWRu35qLVPUsdpn6IhQMTjZbWTUNtRcipMpBEXdYCYlSVqiUytyvQPwfikhEL6xxlRUzg3ICmv-_y7avxFGZuACY24WHhebqgDRH3UHGM1pTPstHZE-6GkfOOmbhbnuVllmWxF6dJW49LUhflcnuxgWzUsisJn6I',\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', 'food', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 1845,\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': 'AelY_CsdYwIyao-ZFeTbGvRcNBGLX_DE8tjTyqyvPTYtQJnqD66SqInRcTchTNu28eK_abcYwwfeCz3UJZKKVoFDo57kPGhpEE2XwrHel2c_3QTgRmo0eVVXewUP0du8S0VNpM2VaOcvaWd3gY11DsW6f_evb9Ke8cUyJq2-YEkkiGkCmXTL',\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', 'food', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 198,\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': 'AelY_CvkKNi1XCRF8KXUW4vPRhWopBByEvtowejh1kBeT9SwxvR55Ynpf185gaGQl5MrWM9BHzPZoZcUnMT9CSY_xbJpcye2pYQw2NsYKn3oaF0i_YNLLLyLkLkyBm7XdMjscrqUF89HcmpJg_O8eG0SuRf_iBEc-WHRUWlA0xZnI8SbDWgW',\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', 'food', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 58,\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': 'AelY_Cuuyz5uSSoYGhoYaP2PNEsMAzCaLdkXuWl3EzGLUAPE9JFPtUPfRJFxKC2N4rJ2PN5zXc5DaqVdM8BQSAbbEoG1OLLLl2d8swBr781Gy83a4PggxNAQyLy9EkzldTr87T_ruEK_TemfvGuHUw3BsttLv3ORmvKNn5qy3YqNq5dId9CF',\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",
" 'store',\n",
" 'health',\n",
" 'food',\n",
" 'point_of_interest',\n",
" 'establishment'],\n",
" 'user_ratings_total': 1339,\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': 'AelY_CspZumKXxG8sJ8daiteT7vHlNzChAc0pI8oIGKlhy-Bxf--jInJCBJOvSpFjudQCNLDLXxxrouUBj3OhvGlUFr5lqVPfifPzxgl8IZd4yRtaIxEi9TyV3iYNY8wXG_T4h_m2gq1HC4fddLt0V1269golC2EZMe_17ZQC_nB4JeSwa6c',\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', 'food', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 386,\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': 'AelY_Cue0Qd_3l-tqxhyZia3e_w4-DLz0Ri4w653dOtxyC2eJJoh12tryLcQpjpDAM8DlKa-7kcTbKauBMr0qzy3616MwlGLaErKZ05AKouqIMXTx_38Q7xNhVGsgpZxL8Bh9w7hFM2QKvoVpvj-10qpzkeIsn7cVTKQTPKo3zBjwQ0duMhm',\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', 'food', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 821,\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': 'AelY_CudWjlIIrn7sYi0vjAlCBMBFA2jctZs7lPY6VPrur2IqGoYiPrs1GlW3aIjDXE01_kWQMcT5feI36FIveSlU3ieF-nJVjrohwkABMWchRd8srOc_SrVPVIdSFpW7AequqSqP3ZNXZx2rsb4HPcFwTY3UToi0WsKMo-6B7ouEKX2m_uD',\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': 932,\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': 'AelY_Csbz9BJnMDSTKpGaYc2UvzhzdtxVsEuN9zPibqGNw2C2fEimD9LXx8c2-fVd_gZCMGpVu48ihL5XCgUSq9x-A1xkggIsrEXnAXxYFnDfBcrdDkgibnvo1064LfDzbB8kn9v3kiazhGDHsBADM5LGnQtE2jY1GqCDuwYQtsWuZyhQy4B',\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', 'food', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 890,\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': 'AelY_CufYCHRj9dZvIuzw0tboFiI0XHrYEll0QykjNn8dWeEXJKbqFxHGQ5VKpP5U4aKp47YplK6aZS1zE_yImOIetDhhti2ChHZhfOZ69FRoaxF-8RbUtG_qxFxf4MZo3hlPRYUTwpHk7p_wKx-SNfTYKjlwf8ZAR4R8_mKAys8j8jGl5Td',\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.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_Ct74WJjR8PUcoaAve9axKBMrRM-xEchZgV5SVxFnD06spQv_PNTun5eJIrX6wkBlgQNnjpn0T8fdanCmymXIklKzRBmqyABjIZqcjG-ojvBRxuS7De1741nfY8mO7JjHy9sImxJ_CSPBbPFwqagjUJ6iFZDESGi0kaAdyqXbrAuWLcB',\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.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': 'AelY_Cv9jauFO6pQIMlVhhs57GV9vzw8OolyYPFN2rgIkWJiUO9fILxTiUz8p9PowmrLvt8E3mDDaq3CO85H_ffBHWSy75SYaLWA8gFskKidajvrpnrV1l52-nxFQC9MVmN3Pi9JzNK0ZwRUZwa2Ej1zFXxUr7qErvlmgo9BVVWHQ2rO82N4',\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', 'food', 'point_of_interest', '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': 'AelY_Cv1teqBgEXWGqLIjb3G5utyeJsPrT0Q7DbbVH3aZ4jsAL9t6pcMr-H69pIL41rOh197j1nn6Kl0LHiFZapKTpmO90p_zRGGnaXuixnbInXBDvVnIvQYGcAoxMxpBLqBN3aYNugtD8qAJ3vdugNmEbMBdh9_Mh1gu8Yydg7STairdPFc',\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",
" 'store',\n",
" 'food',\n",
" 'point_of_interest',\n",
" 'establishment'],\n",
" 'user_ratings_total': 1295,\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': 'AelY_CsGwvDh4wKxt4LNES80egluzjVer1Lz-CaLyfWPJF-1od9NacjWN18KU-syXwhlRFIUJTP-W__PRNLLUeX2LqBVEosnamzAIk3Giok-BxGpNspNEVWFH-NFlNFio4-LnLoLkDCk5bdWyRVuKV73zK_1J2oh2zGXI40Ap5HZbELIaU1p',\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.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': 'AelY_CuFQyEMHHndpPy2BzdJqQIrL7AaFpDEVRr_eMPa10OKfl8O8U3yv0QlgioUYsMbfSteESvyImipaWEEfUTSIfDyLuyqLrX57f2iZv4W0PyDtY3kW4TgXGROqiSXwwDYW1BsiQrRH505RgFIvb5bCWWSIk4gwNBIlU41SPzLzpGXIIAR',\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', 'food', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 1045,\n",
" 'vicinity': '4 Ratchadamri Rd, Pathum Wan'},\n",
" {'business_status': 'OPERATIONAL',\n",
" 'geometry': {'location': {'lat': 13.7292254, 'lng': 100.534336},\n",
" 'viewport': {'northeast': {'lat': 13.73059442989272,\n",
" 'lng': 100.5356763298927},\n",
" 'southwest': {'lat': 13.72789477010728, 'lng': 100.5329766701073}}},\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': 'Shangarila Restaurant Thaniya',\n",
" 'opening_hours': {'open_now': True},\n",
" 'photos': [{'height': 3024,\n",
" 'html_attributions': ['พิชญุตม์ โชติวรรณ'],\n",
" 'photo_reference': 'AelY_CvT3RCsDG7ySTfNot6L3dJrTxaJtW-N7c3qSSTZSEmRYuHd-fS1bvySy0Ov3L7k6ATQc7I3wxDYYj6E5PxP8F8zhCxekNCEZ-oSy4PLqN6MKQMxkRQWnQBawLgj772M2XGB9g9PggVuBuu6Ws1HWAL0tX_Uud73An5fKKOEc2STFv26',\n",
" 'width': 4032}],\n",
" 'place_id': 'ChIJ2_m48Cuf4jARqVdR9So3yvA',\n",
" 'plus_code': {'compound_code': 'PGHM+MP Bangkok',\n",
" 'global_code': '7P52PGHM+MP'},\n",
" 'price_level': 3,\n",
" 'rating': 4.4,\n",
" 'reference': 'ChIJ2_m48Cuf4jARqVdR9So3yvA',\n",
" 'scope': 'GOOGLE',\n",
" 'types': ['restaurant', 'food', 'point_of_interest', 'establishment'],\n",
" 'user_ratings_total': 1982,\n",
" 'vicinity': '58/3-9 Si Lom Rd, Suriya Wong, Bang Rak'}]"
]
},
"execution_count": 45,
"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",
" }\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
}