File size: 45,481 Bytes
115169a
 
 
 
5831cdb
115169a
 
 
 
 
 
 
 
 
5831cdb
115169a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5831cdb
115169a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5831cdb
115169a
 
 
 
 
 
 
 
 
5831cdb
115169a
 
 
 
 
 
5831cdb
115169a
 
 
 
5831cdb
115169a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
{
 "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': ['<a href=\"https://maps.google.com/maps/contrib/112771822205386110836\">Natthapong Taweesook</a>'],\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': ['<a href=\"https://maps.google.com/maps/contrib/110014743976867613506\">auttapong maesincee</a>'],\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 href=\"https://maps.google.com/maps/contrib/100445062871009806114\">A Google User</a>'],\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 href=\"https://maps.google.com/maps/contrib/112078133470872246639\">A Google User</a>'],\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 href=\"https://maps.google.com/maps/contrib/106367740125040655910\">A Google User</a>'],\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': ['<a href=\"https://maps.google.com/maps/contrib/114367741789682073061\">bow nattanan</a>'],\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 href=\"https://maps.google.com/maps/contrib/106167940718102589718\">A Google User</a>'],\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': ['<a href=\"https://maps.google.com/maps/contrib/100517471815290245216\">Morris</a>'],\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': ['<a href=\"https://maps.google.com/maps/contrib/116484297774759708187\">John May</a>'],\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 href=\"https://maps.google.com/maps/contrib/113103653740302511759\">A Google User</a>'],\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': ['<a href=\"https://maps.google.com/maps/contrib/117331921612988982216\">Nijaya</a>'],\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': ['<a href=\"https://maps.google.com/maps/contrib/100481796849900824855\">Daniel Sakariassen</a>'],\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 href=\"https://maps.google.com/maps/contrib/101204685801512010222\">A Google User</a>'],\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': ['<a href=\"https://maps.google.com/maps/contrib/106198363291758062631\">Sukhum Truengtrachitkul</a>'],\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': ['<a href=\"https://maps.google.com/maps/contrib/100883581885709245229\">Tatsuya Sonnyu</a>'],\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': ['<a href=\"https://maps.google.com/maps/contrib/117204015866668242289\">Colin Chow</a>'],\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 href=\"https://maps.google.com/maps/contrib/113103653740302511759\">A Google User</a>'],\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 href=\"https://maps.google.com/maps/contrib/101031521481016420424\">A Google User</a>'],\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 href=\"https://maps.google.com/maps/contrib/113103653740302511759\">A Google User</a>'],\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': ['<a href=\"https://maps.google.com/maps/contrib/104331204058144967486\">พิชญุตม์ โชติวรรณ</a>'],\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
}