{
"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": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"21"
]
},
"execution_count": 17,
"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",
"len(search_results)"
]
},
{
"cell_type": "code",
"execution_count": 21,
"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': 'AelY_CvxrozpUBgwaqyJq4uqdKevb0Q1jIb5e-9-iTa3p1UnRLagRB9oPMZh-qpBBPvKrZD-COKfcgrgIoVyyUy3Ua5Z79yfP-dSLWJ-_bgTsC4lma7MNfNxccRrd3lAbyRsVg4BC_LDkryzdNAIHFV-w7uwdjs-WsTOQdSLe3vdgi4kE79z',\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': 'AelY_CuUFCr1Xn8QfEToKr0h9qpfkmWx20DoxU9t7VdhZ3vPWeH-r9pYyi9SDfNoD0aispdhMhtDEQ72SYTeXVn-GRrA9GOuOUrXQvhrbXqvZsLR7TMwNJAPMh_V2TLwTioa6djrjBySARGe-Z9PT8aREBPtug1Mi7BAYcjVysl8p845ig3P',\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': 7797,\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': 'AelY_CuPvBLUwSqc2acGJxK-AyDUgQ7TqwPALOScmcJ689yCjW3Ku-kUiLy2AGP7FcmVMh07usZvvK4CzF_3NtKprNTHRC_EdMcpCe647U7mf6U8wEk4YcjkJXa3D9ilUnHvD2m9bn2vLfJqtYJbQwlxTyVP4v8NLFfGzLEsJKYLllUsg7Q3',\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': 'AelY_Cs_azJjqpTcuRvQNwnprg66S-KWI59xF-mYbetmkxC2_x8SwHuAMq5mBcCEDdIhx4rjuF1PcIKEjhzHds05qbUR-GtmO1dcIKmkcBM6_7pErJPQmrL3mBBO-ZI_rxN_s7YJijhHx2I3lUC3pUiSp3ywhVqfpJd1uwWakcgjXEA2SZ-j',\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': ['bar',\n",
" 'spa',\n",
" 'lodging',\n",
" 'restaurant',\n",
" 'point_of_interest',\n",
" 'food',\n",
" 'establishment'],\n",
" 'user_ratings_total': 6174,\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': False},\n",
" 'photos': [{'height': 4752,\n",
" 'html_attributions': ['Evergreen Place Bangkok'],\n",
" 'photo_reference': 'AelY_CsWD7ZNdgJzglkPTkh7D4doszXuLOKhdY-EIgBdcscHjfFi7ghq_WHd6mhvmvPg2Prv2JKaHOSyvdTjmGY7buNU_IzVD6ec3EeacfYfSU1sGcRoh_1j5QszrL5toXCE66a-Z3i7sDlugWLdJ3tpeXRqdAoyVKJt03vETozAq2B9PFsP',\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': 2226,\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': 'AelY_Ctmc221h_UmcZMFZh0MQe2D0qaQn1kbBe8XANeE0FlQEEIBBQfPOJNETYv4rDZOmpFx2gS52qjar2aVgzIhv2HTUAKBtIvxMCl4Oz6g0gGDBQlBBjvnDaDqJHxRa5qqXpaxuS1bQ0dpyzY7VFMGroLw515bRm-bZuyfHl7cMSv1OJmP',\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': 'AelY_CstMzGHLpjMYjMIFO0fZOp91KOp5mS8cifLEJFib8157m5q_i_QaLvzXXB7xgQdtVEFDcP3LDVJiB0qi_L8nFCLhy1RvI2l8P1kA2m4kwQKG95OobQK48ff_6yYyV1_G6adse2xh3pFC1HYCRLwKxPKnwzst1l2o_92ZDbOji547MpJ',\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': 5464,\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': 'AelY_Cs2YsUigq7PlEoW3a4lvyYOx0Y_acPHgRKRlqU4PQKiZkx_Ay-6BLHhVlsqxCS0JKUOmqCDzl9IaCaLwF2gdeKamP9udR7DdCqTqloOhMbs3LgG8FAHUYLw6qzPcd4AHHGZpAw33YgseaNBU7wtTMqJ0q3Zgufv-I7FIr1vM4xakymF',\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': 'AelY_CuY1GHah0waKhYb5rI5FJhFLndTLLmL5XdYHbNv91pK_OgTB1QrZYvS24qza4DypUkwst0nCaQZdQgu2_tuXeNYlguBczbgcOzujIdEUDr8QlGNW2rVFE8mfBKPvWCRmcMAJ9gCAO1Ygt3SYJVn2aY_WKJ8S14Oiz45ulQJg363vB5n',\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': 'AelY_CsD59xSc1LZoQmRGMw4lvEZAhpx0mlnTmJLpcJ_QwE5t5g2npjyDQPsc4AMsUTp53JQuu4u6Gnc5lWL03_4t-4RDr1ihAeyM9riHo0fi3s_tHSYZOyqDnM7moVf9FMf4OZ1laVWJ_vZc3FxbDo-hM0Tva2u-8osxwu32RLHgAPGQXM-',\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': 1055,\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': 'AelY_CuEOasModXU9zwcq5un-8pYAExtWccLMlsKsXx8LnvaXn41EQwuiEnplHcqIK-TTnKQIPtbcWfw8gbozD-_wXF9AIINFvGtgxcRl2oYdEbo5JF_YBhWZDEFY6gMlNl5a5yvW55eHxRo5Pp7zhzLd354aySe6d3pjCmeD-NdWsWjRhf8',\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': 3962,\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': True},\n",
" 'photos': [{'height': 4000,\n",
" 'html_attributions': ['Lub d Bangkok Siam'],\n",
" 'photo_reference': 'AelY_CvvpAZ8KbpLLWkUDMyNtFAUrHW7mzlJJlMcqeADuPWhTgsA9QDXu8-Hn1XyqvbAgqTBSD7TcOYF7yOHJsZ225nUJwGbSH2h_suh4ShA89eJmARoEagdByyHxVeC96HrGCI1plptbReIFGiakm2wG5D6QVx2_49q-RK8QQdybBKG-SP-',\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': 'AelY_Csn9nBQAdfUq9vFqGNFcbaay6GJd-hW6_xnOSisGN0nyuhlbhwepo1F4xNSmSJ9drm2YzWjX_Zmka5TG57VqzHonWfoAPSzG8XJfIWYawGxqhRUpLuNWWmw8aWmctdRP7jJSTflqxM8b-a0ONxsi0kMcIAQqP_zFDQAmT_be40Cs3Gp',\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': 'AelY_CuCrEVvpPHq1Qx7GV5SrgV1vgByC1kh4uO4QnAXW1ZtvDXt-6Ovf4qPjHH_qv7LLiHzzmWb7wro2PRpVKsEEHxL00GQkVb3kQAqjpFnbGot_pRdisqpEz-72t8zaykrdMnOvoyN3z7VJuqpUM0BabTb0fMsawNzmCriH8qQ_JAlL2Mz',\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': 3161,\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': 'AelY_CvB6Nq0MiEYNioUgOhi_zI5RWgYVFIP9CaQOsUrrLLMVBNjx-KgnlUbxeM_JWzitpROdmijOoq06G3vaNu91HD8NLJHY0ALwOMeeefYekqp-JKtPpK0bqJ2LEu_Qoff_Jq2MbA2i8_6NnHAWybZmF_2RxsBzQz1nDcwFgedHj3Gw1n6',\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': 'AelY_CvrgCeTyLQym5A-66-Dwbyb2CN7qeiTgQsbaRhZ3BrSn9qNLvrFa5riWSfk2DeApHWYXdrih4pMfG-5KHS1gBso2UUKKY4yPPkOO7vw3r_GoCFdWQdzhZ4XdVP4GrbsVc6pI2GW91PrYmUjkS2gGCt1-HjlDH2yEtuOXXpwR-rSubWC',\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': 3326,\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': 'AelY_CsW2Wt0Yq-d8YYNkZ7A3o2Uz8zUTIlcOWZXFkYUcw_g5emS1X1NUJLBg4zk23ow4i0sOkunBTckLzYVRERyvjzRIA3cSoOCDyFgOqDCGYa76sdyNBm7-7XDUTzN9ErAtWjh0D4wtLlmQUFu5I48vz-Dj8pcKwRCYeRkfwicouhLwwWx',\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': 5376,\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': 'AelY_Cs1De3U3uVUvVlLVxo26_WobY6kNU2JiZOtXgalXmz0CrT84zk7BaqchadRIPWy4QLCRiEWW9x18bkMudmNdyXTp93_mK3tjlR7beIPl8B8iQ8s4PglsZkyhEj_gNY7Rw544MFoiUVm52oShN-sLGtc-IMQpgh-iExn6RIFoaxGXN-i',\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': 18879,\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': 'AelY_CsPUz4IekyvYLFtu8rLUEiZzGeoywWadqau0ur1bIvPwDUc5OFzUtEp0AYmR_qXqiktw0gOeqzGVCtS6gNUS-6d7caXIzOK9s1vjxLw5BPCRkJJl39wmEhDcKkj8t6l1OG_Cwt_7lHqzcr0aosCwLCMJk9hcLlv8KsTVyDm6eSEODRx',\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': 'AelY_CtqZEpQm8sflxWqjaUdSG3aRhGRttKfrq1X1uEpAsfVLIQEXxn3ARkYtSffxLIOB297q4x3RC5cclyYcKJzhnxlPGg4hwK7Xdq3HMn7gcgELImDzwUCyDBv1Bw2YJEaDEunorOLlVN38rUnZplAo2drZkqfkUfUB57aCoLaVu91_SAB',\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": 21,
"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
}