File size: 77,240 Bytes
838e061
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
{
 "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. NYLA Fashion Island\\nAddress: 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: ChIJeUgI3A5jHTERdzu6oMzUSCk\\nPhone: 02 947 5938\\nWebsite: Unknown\\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. 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\\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. 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\\n9. Panya Ramintra\\nAddress: Khan Na Yao, Bangkok 10230, Thailand\\nGoogle place ID: ChIJ9e97xwhjHTERR-MWDuKtUYY\\nPhone: Unknown\\nWebsite: Unknown\\n\\n\\n10. 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\\n11. ร้านชุดชั้นใน 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\\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. 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": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'candidates': [{'formatted_address': '45 1 ตำบล วังกระแจะ เมือง ตราด 23000 ไทย', 'geometry': {'location': {'lat': 15.870032, 'lng': 100.992541}, 'viewport': {'northeast': {'lat': 15.8707744, 'lng': 100.9936482298927}, 'southwest': {'lat': 15.86780479999999, 'lng': 100.9909485701073}}}, 'name': 'โรงแรมสุทธิวารี', 'opening_hours': {'open_now': True}, 'rating': 5}], '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 = \"hotel\"\n",
    "result = find_place_from_text(input_text, location)\n",
    "\n",
    "print(result)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Coordinates: 13.744677,100.5295593\n"
     ]
    }
   ],
   "source": [
    "def find_location(input_text:str, location:str=None, radius=10000):\n",
    "    # Call the find_place_from_text function to get the location data\n",
    "    data = find_place_from_text(input_text, location, radius)\n",
    "\n",
    "    # Extract the latitude and longitude from the response\n",
    "    candidates = data.get('candidates', [])\n",
    "    if len(candidates)==0:\n",
    "        raise ValueError(\"No location found.\")\n",
    "\n",
    "    # Assuming we're taking the first candidate\n",
    "    geometry = candidates[0].get('geometry', {})\n",
    "    location = geometry.get('location', {})\n",
    "\n",
    "    latitude = location.get('lat')\n",
    "    longitude = location.get('lng')\n",
    "\n",
    "    if latitude is None or longitude is None:\n",
    "        raise ValueError(\"Latitude or Longitude not found in the response.\")\n",
    "\n",
    "    # Return the latitude and longitude as a formatted string\n",
    "    return f\"{latitude},{longitude}\"\n",
    "\n",
    "\n",
    "location = \"15.87,100.9925\"  # Latitude and Longitude\n",
    "input_text = \"มาบุญครอง\"\n",
    "coordinates = find_location(input_text, location)\n",
    "print(f\"Coordinates: {coordinates}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'business_status': 'OPERATIONAL',\n",
       "  'geometry': {'location': {'lat': 13.7455309, 'lng': 100.5198334},\n",
       "   'viewport': {'northeast': {'lat': 13.74692812989272,\n",
       "     'lng': 100.5214657798927},\n",
       "    'southwest': {'lat': 13.74422847010728, 'lng': 100.5187661201073}}},\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': ['<a href=\"https://maps.google.com/maps/contrib/115779328569151334983\">A Google User</a>'],\n",
       "    'photo_reference': 'AXCi2Q5REfgaHadtFNqXOFpuxkVdoFf0rM5zy9Piw_WeOcuTwSKMqU2CgFnQoN6BRclj7SQ4s_eccxIdMd-Ul1pvz0EOjBikoWSlxvqLoZIauLg-YzlVvqfpd2bU0OfVKNarBaHYWn2hPMC0n2wShcIaz4I1hc89Bab018M4-BFexDp_gMFc',\n",
       "    'width': 2000}],\n",
       "  'place_id': 'ChIJ_zP3fy-Z4jARWYaBArPXGAg',\n",
       "  'plus_code': {'compound_code': 'PGW9+6W Bangkok',\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 ตัดใหม่ Rong Muang, Pathum Wan'},\n",
       " {'business_status': 'OPERATIONAL',\n",
       "  'geometry': {'location': {'lat': 13.7467728, 'lng': 100.5294726},\n",
       "   'viewport': {'northeast': {'lat': 13.74811892989272,\n",
       "     'lng': 100.5308482298927},\n",
       "    'southwest': {'lat': 13.74541927010728, 'lng': 100.5281485701073}}},\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': 'Muangphol Mansion',\n",
       "  'opening_hours': {'open_now': False},\n",
       "  'photos': [{'height': 3000,\n",
       "    'html_attributions': ['<a href=\"https://maps.google.com/maps/contrib/107774912115800487369\">Hassan Ahmadian</a>'],\n",
       "    'photo_reference': 'AXCi2Q4AS3FJWETxFu9WbBFhhNhmjsSQZiKqiIGEVmqYgaPqhsgy9g7bWpjLp5WDzQQTnZPkrpAVnXTIQDxN3y_JF36mBoF0LVqgsrWVumTiokIETibGLIY7pL7ujSc7sqvOkr-WcX6pC9N8AyASE-vszjVYdso6gUCl8DtdalINk-bXBa8r',\n",
       "    'width': 4000}],\n",
       "  'place_id': 'ChIJZzgIrTKZ4jARJYzilmi9T74',\n",
       "  'plus_code': {'compound_code': 'PGWH+PQ Bangkok',\n",
       "   'global_code': '7P52PGWH+PQ'},\n",
       "  'rating': 3.3,\n",
       "  'reference': 'ChIJZzgIrTKZ4jARJYzilmi9T74',\n",
       "  'scope': 'GOOGLE',\n",
       "  'types': ['lodging', 'point_of_interest', 'establishment'],\n",
       "  'user_ratings_total': 113,\n",
       "  'vicinity': '8, 931 Rama I Rd, Wang Mai, Pathum Wan'},\n",
       " {'business_status': 'OPERATIONAL',\n",
       "  'geometry': {'location': {'lat': 13.7468712, 'lng': 100.52869},\n",
       "   'viewport': {'northeast': {'lat': 13.74810307989272,\n",
       "     'lng': 100.5300171798927},\n",
       "    'southwest': {'lat': 13.74540342010728, 'lng': 100.5273175201073}}},\n",
       "  'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/lodging-71.png',\n",
       "  'icon_background_color': '#909CE1',\n",
       "  'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/hotel_pinlet',\n",
       "  'name': 'Lub d Bangkok Siam',\n",
       "  'opening_hours': {'open_now': False},\n",
       "  'photos': [{'height': 4000,\n",
       "    'html_attributions': ['<a href=\"https://maps.google.com/maps/contrib/110664455171949656649\">Lub d Bangkok - Siam Square</a>'],\n",
       "    'photo_reference': 'AXCi2Q6jzkjlHJJaGkIjVVevWBny8MMkNw90qEwgUEaQWAgPbdj4R12eZrVTpoUGawjhwWrDFuWSdEncNcPSncrVFNc2XcbEgE9dpjiGGKSWjUuwO9wFJBKBzEuNq16ey7eVMC8MPQRgqeE0rYKeY1o4IwNEKCEHmKigl3xvnURQ3HMTcPfQ',\n",
       "    'width': 6000}],\n",
       "  'place_id': 'ChIJc33lpDKZ4jARil4bO37UbIs',\n",
       "  'plus_code': {'compound_code': 'PGWH+PF Bangkok',\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 Rd, Wang Mai, Pathum Wan'},\n",
       " {'business_status': 'OPERATIONAL',\n",
       "  'geometry': {'location': {'lat': 13.7627061, 'lng': 100.5381273},\n",
       "   'viewport': {'northeast': {'lat': 13.76412432989272,\n",
       "     'lng': 100.5396005798927},\n",
       "    'southwest': {'lat': 13.76142467010728, 'lng': 100.5369009201073}}},\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 Victory View',\n",
       "  'opening_hours': {'open_now': True},\n",
       "  'photos': [{'height': 4000,\n",
       "    'html_attributions': ['<a href=\"https://maps.google.com/maps/contrib/101078213475534837237\">A Google User</a>'],\n",
       "    'photo_reference': 'AXCi2Q5sc9dLfaqO79qSoPvgA6E9rcouVekbl-jKloKDhM5ZVhnKmqEE2k9-jeg4kDUtFt-gE-f5P4YbOU2vdIjGaYg7GJyrzDrT7xLpT_UbIH2Km19g_H-JgQd1D3afrBvjtRklWFwDoCw7TnZtPqyF7GGia6yp4qPp7OLspmGR04BV0oAn',\n",
       "    'width': 6000}],\n",
       "  'place_id': 'ChIJ23PzgMme4jARFOY5eyKACAA',\n",
       "  'plus_code': {'compound_code': 'QG7Q+37 Bangkok',\n",
       "   'global_code': '7P52QG7Q+37'},\n",
       "  'rating': 4,\n",
       "  'reference': 'ChIJ23PzgMme4jARFOY5eyKACAA',\n",
       "  'scope': 'GOOGLE',\n",
       "  'types': ['lodging', 'point_of_interest', 'establishment'],\n",
       "  'user_ratings_total': 125,\n",
       "  'vicinity': '34/2-3 Soi Ratchawithi 9, Thanon Phaya Thai, Ratchathewi'},\n",
       " {'business_status': 'OPERATIONAL',\n",
       "  'geometry': {'location': {'lat': 13.7291738, 'lng': 100.5348174},\n",
       "   'viewport': {'northeast': {'lat': 13.73046032989272,\n",
       "     'lng': 100.5361918298927},\n",
       "    'southwest': {'lat': 13.72776067010728, 'lng': 100.5334921701073}}},\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': 'Pula Silom',\n",
       "  'photos': [{'height': 2736,\n",
       "    'html_attributions': ['<a href=\"https://maps.google.com/maps/contrib/116104521503291528513\">伊藤弘昭</a>'],\n",
       "    'photo_reference': 'AXCi2Q7Jx_Q-bmUQXHf21Up5jca5HIbehddLbxXNbliIJzRtirLIoDxEZBB29hDcPKa4l5xVKWDbHobbvvrO_L2DFMonrHr5s36M3_0dLea9j_KPOhtmXMp1T_0ZMfyX7-fwwN7xivn2o1fJ9k8XduGbbGLAlllgBa0TmT4jEZYN4qcNHRpi',\n",
       "    'width': 3648}],\n",
       "  'place_id': 'ChIJbbU8_yuf4jARUTtSdD5kt7s',\n",
       "  'plus_code': {'compound_code': 'PGHM+MW Bangkok',\n",
       "   'global_code': '7P52PGHM+MW'},\n",
       "  'rating': 4.1,\n",
       "  'reference': 'ChIJbbU8_yuf4jARUTtSdD5kt7s',\n",
       "  'scope': 'GOOGLE',\n",
       "  'types': ['lodging', 'point_of_interest', 'establishment'],\n",
       "  'user_ratings_total': 408,\n",
       "  'vicinity': '60/12-15 Si Lom Rd, Silom, Bang Rak'},\n",
       " {'business_status': 'OPERATIONAL',\n",
       "  'geometry': {'location': {'lat': 13.7446989, 'lng': 100.5430063},\n",
       "   'viewport': {'northeast': {'lat': 13.74605242989272,\n",
       "     'lng': 100.5443317298927},\n",
       "    'southwest': {'lat': 13.74335277010728, 'lng': 100.5416320701073}}},\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': 'Golden House',\n",
       "  'opening_hours': {'open_now': True},\n",
       "  'photos': [{'height': 2017,\n",
       "    'html_attributions': ['<a href=\"https://maps.google.com/maps/contrib/113819510353645451169\">Golden House</a>'],\n",
       "    'photo_reference': 'AXCi2Q7SNGkVzsificYOCpcJLixqVPAvgsnlvH8BqnoPmI5dKRJDzd5v5TOYHyQoZKkGVHoPzjr1Z964FihrKk-k_1PZw_J1ME_nsux1Q_xbozq6iekPVS7n6RvmuH6ueYSp0XTpo0FeawGHoJuy_5DPlHC9nJHYkzsl2mMcF2sb7-jqG1gZ',\n",
       "    'width': 3162}],\n",
       "  'place_id': 'ChIJIcSl3Nqe4jARnLh2qK_RMRo',\n",
       "  'plus_code': {'compound_code': 'PGVV+V5 Bangkok',\n",
       "   'global_code': '7P52PGVV+V5'},\n",
       "  'rating': 3.7,\n",
       "  'reference': 'ChIJIcSl3Nqe4jARnLh2qK_RMRo',\n",
       "  'scope': 'GOOGLE',\n",
       "  'types': ['lodging', 'point_of_interest', 'establishment'],\n",
       "  'user_ratings_total': 203,\n",
       "  'vicinity': '1025/5-9 Ploenchit Road, Lumpinee, Pathum Wan'},\n",
       " {'business_status': 'OPERATIONAL',\n",
       "  'geometry': {'location': {'lat': 13.7559816, 'lng': 100.5363536},\n",
       "   'viewport': {'northeast': {'lat': 13.75731082989272,\n",
       "     'lng': 100.5377502298927},\n",
       "    'southwest': {'lat': 13.75461117010728, 'lng': 100.5350505701073}}},\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': 'Top High Airport Link Hotel',\n",
       "  'opening_hours': {'open_now': True},\n",
       "  'photos': [{'height': 2832,\n",
       "    'html_attributions': ['<a href=\"https://maps.google.com/maps/contrib/109602767181864547532\">A Google User</a>'],\n",
       "    'photo_reference': 'AXCi2Q4dmmfllqiiSF6ET2O85klRu0znHLiv413DFjpor2RQow_l7XzHA-SqwKwO2z1_52DLfGzanhokS0pZscaSKNfS6jPcKC9mCwMllD5ZyOAP8GxyQiyslP5Y5RjAiBkXy8ViRv4aOSthNUehBdks-7yQmII9BxLx-Elpm4InCk46UlmZ',\n",
       "    'width': 4256}],\n",
       "  'place_id': 'ChIJcefUlMme4jARJGbWS6DCn9c',\n",
       "  'plus_code': {'compound_code': 'QG4P+9G Bangkok',\n",
       "   'global_code': '7P52QG4P+9G'},\n",
       "  'rating': 3.9,\n",
       "  'reference': 'ChIJcefUlMme4jARJGbWS6DCn9c',\n",
       "  'scope': 'GOOGLE',\n",
       "  'types': ['lodging', 'point_of_interest', 'establishment'],\n",
       "  'user_ratings_total': 1119,\n",
       "  'vicinity': '33 Soi Phetchaburi 11, Thanon Phaya Thai, Ratchathewi'},\n",
       " {'business_status': 'OPERATIONAL',\n",
       "  'geometry': {'location': {'lat': 13.7614685, 'lng': 100.5376939},\n",
       "   'viewport': {'northeast': {'lat': 13.76284452989272,\n",
       "     'lng': 100.5389958798927},\n",
       "    'southwest': {'lat': 13.76014487010728, 'lng': 100.5362962201073}}},\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': 'Rose Apple Hotel',\n",
       "  'photos': [{'height': 3024,\n",
       "    'html_attributions': ['<a href=\"https://maps.google.com/maps/contrib/109608969410824168250\">Fred</a>'],\n",
       "    'photo_reference': 'AXCi2Q6zjoNtQ1zTKlHiyZ7PRXL2tageAblx1DpY1sYVYImvQw9DRkx86IKGJWiDbUiunBtN2wmFSlO2SYhFDND5Wm7fRBI0ll_8tOv0bFf-iIV-vpeEf_3vx-ABaqgeK7N4vuUnK_21XznpBAu19j5MptYAFiKOPmDYZ6_SJ7aIbsZNkQqu',\n",
       "    'width': 4032}],\n",
       "  'place_id': 'ChIJXTStwbCe4jARXRRo179r6nk',\n",
       "  'plus_code': {'compound_code': 'QG6Q+H3 Bangkok',\n",
       "   'global_code': '7P52QG6Q+H3'},\n",
       "  'rating': 4.4,\n",
       "  'reference': 'ChIJXTStwbCe4jARXRRo179r6nk',\n",
       "  'scope': 'GOOGLE',\n",
       "  'types': ['lodging', 'point_of_interest', 'establishment'],\n",
       "  'user_ratings_total': 139,\n",
       "  'vicinity': '29/1 Soi Loet Punya, Thanon Phaya Thai, Ratchathewi'},\n",
       " {'business_status': 'OPERATIONAL',\n",
       "  'geometry': {'location': {'lat': 13.751193, 'lng': 100.5355507},\n",
       "   'viewport': {'northeast': {'lat': 13.75254982989272,\n",
       "     'lng': 100.5368565298927},\n",
       "    'southwest': {'lat': 13.74985017010728, 'lng': 100.5341568701073}}},\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': ['<a href=\"https://maps.google.com/maps/contrib/102286478336053372469\">The Residence Rajtaevee</a>'],\n",
       "    'photo_reference': 'AXCi2Q5SM-DKx1XwfyUEK-5LuAzlFJMjmEgByT5v-0Q5iulo2CiIqOaPotdKbRBCObOYwsMfbasqecewPpWrqWQ_Iz6e7sAeSUVDlAfzwszEEb8WZBPG3IiPEUybhxfLmaG_Ubi5vX16bJYjDTjBVN493Tx_7zzkClVJiwVhhpZiDSIVwekh',\n",
       "    'width': 1600}],\n",
       "  'place_id': 'ChIJx0cHr86e4jAReGZBl579QlY',\n",
       "  'plus_code': {'compound_code': 'QG2P+F7 Bangkok',\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 Rd, Khwaeng Thanon Phetchaburi, Ratchathewi'},\n",
       " {'business_status': 'OPERATIONAL',\n",
       "  'geometry': {'location': {'lat': 13.7431972, 'lng': 100.5301387},\n",
       "   'viewport': {'northeast': {'lat': 13.74441047989272,\n",
       "     'lng': 100.5314606298927},\n",
       "    'southwest': {'lat': 13.74171082010728, 'lng': 100.5287609701073}}},\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': ['<a href=\"https://maps.google.com/maps/contrib/105529198599736349764\">A Google User</a>'],\n",
       "    'photo_reference': 'AXCi2Q5vfp2-YyDznWo7BzJjpWdDG46oBD_E361wRvxqbPuTWQXeqw6ZJKLs4ApM57kGqfBWFCM8X4Ge1eMcr1CYyL2G2g2D5xaSjH0aZhOVby1DTuhoaQIutT1dD_bvhLC1L1yOh6_VEagO8MONFPbsVglCBG-5KdYWP8sz5Pb0msg92dLP',\n",
       "    'width': 3000}],\n",
       "  'place_id': 'ChIJFaLTtdKe4jARdKflx49LvdA',\n",
       "  'plus_code': {'compound_code': 'PGVJ+73 Bangkok',\n",
       "   'global_code': '7P52PGVJ+73'},\n",
       "  'rating': 4.5,\n",
       "  'reference': 'ChIJFaLTtdKe4jARdKflx49LvdA',\n",
       "  'scope': 'GOOGLE',\n",
       "  'types': ['shopping_mall',\n",
       "   'tourist_attraction',\n",
       "   'restaurant',\n",
       "   'food',\n",
       "   'lodging',\n",
       "   'point_of_interest',\n",
       "   'establishment'],\n",
       "  'user_ratings_total': 7827,\n",
       "  'vicinity': '444 Phaya Thai Rd, Wang Mai, Pathum Wan'},\n",
       " {'business_status': 'OPERATIONAL',\n",
       "  'geometry': {'location': {'lat': 13.7419343, 'lng': 100.5246099},\n",
       "   'viewport': {'northeast': {'lat': 13.74333472989272,\n",
       "     'lng': 100.5259674798927},\n",
       "    'southwest': {'lat': 13.74063507010728, 'lng': 100.5232678201073}}},\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': 'HOUSE OF PAPA BANGKOK SIAM',\n",
       "  'opening_hours': {'open_now': True},\n",
       "  'photos': [{'height': 1044,\n",
       "    'html_attributions': ['<a href=\"https://maps.google.com/maps/contrib/107232611473859075352\">A Google User</a>'],\n",
       "    'photo_reference': 'AXCi2Q7jN3KUm4mIFgLRlbT3_UYH3VfSHoCBZX_9ovZXRxxVFG2RyJqj6iOeWGYDnZ0f4NG4cHNrbwNynR4hstsMUDDhafMc5thD8K1iBF-31OivN6fPwA0pqRt9HLNErtmiSxJugmpFqHV2u7q7Y1OCbFOyVfX_c3oLD24mzhkv5T960Ugf',\n",
       "    'width': 1568}],\n",
       "  'place_id': 'ChIJQVtmplSZ4jARsWxKD388HB0',\n",
       "  'plus_code': {'compound_code': 'PGRF+QR Bangkok',\n",
       "   'global_code': '7P52PGRF+QR'},\n",
       "  'rating': 4.2,\n",
       "  'reference': 'ChIJQVtmplSZ4jARsWxKD388HB0',\n",
       "  'scope': 'GOOGLE',\n",
       "  'types': ['lodging', 'point_of_interest', 'establishment'],\n",
       "  'user_ratings_total': 165,\n",
       "  'vicinity': '188/44, Soi Chula 16, Wang Mai, Pathum Wan'},\n",
       " {'business_status': 'OPERATIONAL',\n",
       "  'geometry': {'location': {'lat': 13.7471052, 'lng': 100.5289501},\n",
       "   'viewport': {'northeast': {'lat': 13.74819247989272,\n",
       "     'lng': 100.5302628798927},\n",
       "    'southwest': {'lat': 13.74549282010728, 'lng': 100.5275632201073}}},\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': 'ไอบิส กรุงเทพ สยาม',\n",
       "  'photos': [{'height': 1920,\n",
       "    'html_attributions': ['<a href=\"https://maps.google.com/maps/contrib/106297763246544925516\">Hotel ibis Bangkok Siam</a>'],\n",
       "    'photo_reference': 'AXCi2Q5xaKlLVvq7ppUkSrD2tnTn34qtSlCFgfmE6xsnlhr1DA8wQ22pDGhzknJ1BKfmWax-GKW57vntFfXOVmTzM6fud-hatURpuFzGVmMPmu1716oqhBBk6mRvwRQN5bxsX5Wr_-yV_IOTrcjtTBG5-eCB8yETQeym9mDEVMIzogyoqA45',\n",
       "    'width': 2880}],\n",
       "  'place_id': 'ChIJaUcw7c2e4jAR0sfKCxcl2aM',\n",
       "  'plus_code': {'compound_code': 'PGWH+RH Bangkok',\n",
       "   'global_code': '7P52PGWH+RH'},\n",
       "  'rating': 4.4,\n",
       "  'reference': 'ChIJaUcw7c2e4jAR0sfKCxcl2aM',\n",
       "  'scope': 'GOOGLE',\n",
       "  'types': ['lodging', 'point_of_interest', 'establishment'],\n",
       "  'user_ratings_total': 2873,\n",
       "  'vicinity': '927 Rama I Rd, Wangmai, Pathum Wan'},\n",
       " {'business_status': 'OPERATIONAL',\n",
       "  'geometry': {'location': {'lat': 13.7364607, 'lng': 100.5485186},\n",
       "   'viewport': {'northeast': {'lat': 13.73779277989272,\n",
       "     'lng': 100.5499788798927},\n",
       "    'southwest': {'lat': 13.73509312010728, 'lng': 100.5472792201073}}},\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 Quart Ruamrudee by UHG',\n",
       "  'photos': [{'height': 1108,\n",
       "    'html_attributions': ['<a href=\"https://maps.google.com/maps/contrib/113607345716697552408\">A Google User</a>'],\n",
       "    'photo_reference': 'AXCi2Q6b1PqeLgJRnsC_1ElB0ibnqOOYWLhi7YE8J8RXFjeThrX1q51n0lP9LMzOvlSGxgpzzkbbu1ZPuAFfJ_GZswMXlZClrcN7iSDuMtfMXdL_knJHUBWe-1Eescu0Mnx09aL6gnivm4cDvinyBeBWxG9bDk-d6vcpNoICJ0fiO2MmZd2q',\n",
       "    'width': 1477}],\n",
       "  'place_id': 'ChIJS5Dv_n-f4jARd6xZQlSXjlM',\n",
       "  'plus_code': {'compound_code': 'PGPX+HC Bangkok',\n",
       "   'global_code': '7P52PGPX+HC'},\n",
       "  'rating': 3.9,\n",
       "  'reference': 'ChIJS5Dv_n-f4jARd6xZQlSXjlM',\n",
       "  'scope': 'GOOGLE',\n",
       "  'types': ['lodging', 'point_of_interest', 'establishment'],\n",
       "  'user_ratings_total': 538,\n",
       "  'vicinity': '38/3 Soi Ruamrudee Community, Lumphini, Pathum Wan'},\n",
       " {'business_status': 'OPERATIONAL',\n",
       "  'geometry': {'location': {'lat': 13.7322506, 'lng': 100.5271641},\n",
       "   'viewport': {'northeast': {'lat': 13.73356032989272,\n",
       "     'lng': 100.5285219298927},\n",
       "    'southwest': {'lat': 13.73086067010728, 'lng': 100.5258222701073}}},\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': 'Sam Yan Serene Hotel',\n",
       "  'photos': [{'height': 2268,\n",
       "    'html_attributions': ['<a href=\"https://maps.google.com/maps/contrib/117301360290051310020\">塩谷, 一</a>'],\n",
       "    'photo_reference': 'AXCi2Q7n1pLt2iSHnPmh_q5Mf2g99zD3kKVTJnJfciX6R3SUcQWZ9xw2wC4xDlLgOWwwlwFwyqkc1EB-YBTEXg4RmDbTc5ynGR-ujCNJWJh8GAia999zgcok_-UWt0sta4E_wO4dCV6H_EMdu-iu6qSxxTt-uexcCbW8AHVpKEiwzsaRS5bQ',\n",
       "    'width': 4032}],\n",
       "  'place_id': 'ChIJq_Saj9aY4jAREUtIU3WA4Gk',\n",
       "  'plus_code': {'compound_code': 'PGJG+WV Bangkok',\n",
       "   'global_code': '7P52PGJG+WV'},\n",
       "  'rating': 4,\n",
       "  'reference': 'ChIJq_Saj9aY4jAREUtIU3WA4Gk',\n",
       "  'scope': 'GOOGLE',\n",
       "  'types': ['lodging', 'point_of_interest', 'establishment'],\n",
       "  'user_ratings_total': 285,\n",
       "  'vicinity': '38 Si Phraya Rd, Bangkok'},\n",
       " {'business_status': 'OPERATIONAL',\n",
       "  'geometry': {'location': {'lat': 13.7372782, 'lng': 100.5170473},\n",
       "   'viewport': {'northeast': {'lat': 13.73869057989272,\n",
       "     'lng': 100.5184239798927},\n",
       "    'southwest': {'lat': 13.73599092010728, 'lng': 100.5157243201073}}},\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': 'Metro Hotel',\n",
       "  'opening_hours': {'open_now': True},\n",
       "  'photos': [{'height': 5067,\n",
       "    'html_attributions': ['<a href=\"https://maps.google.com/maps/contrib/105029968180924602999\">A Google User</a>'],\n",
       "    'photo_reference': 'AXCi2Q7cr19LNUMipfJeB7TnqQw6nXsB26EadyXaYKXWhY4D-_dLCE45b14GtGoHkowfV10UsE4N6EmR3w_CsLSOEpeyGkRIU-rnP3-8lf-xyVl6om-Rc6RvpSI2QCx8OrbOJZIl1BBc0icvbAMD-ctah05qNmdiJwR0Kdh8HlAO_8H_zk9Q',\n",
       "    'width': 3378}],\n",
       "  'place_id': 'ChIJIeFfV9aZ4jARpd4v7wFD6BQ',\n",
       "  'plus_code': {'compound_code': 'PGP8+VR Bangkok',\n",
       "   'global_code': '7P52PGP8+VR'},\n",
       "  'rating': 4.8,\n",
       "  'reference': 'ChIJIeFfV9aZ4jARpd4v7wFD6BQ',\n",
       "  'scope': 'GOOGLE',\n",
       "  'types': ['lodging', 'point_of_interest', 'establishment'],\n",
       "  'user_ratings_total': 654,\n",
       "  'vicinity': '326, 20-22 Rama IV Rd, Mahapreuttaram, Bang Rak'},\n",
       " {'business_status': 'OPERATIONAL',\n",
       "  'geometry': {'location': {'lat': 13.7465184, 'lng': 100.5408834},\n",
       "   'viewport': {'northeast': {'lat': 13.74800027989272,\n",
       "     'lng': 100.5420810298927},\n",
       "    'southwest': {'lat': 13.74530062010728, 'lng': 100.5393813701073}}},\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': 'Arnoma Grand Bangkok',\n",
       "  'opening_hours': {'open_now': False},\n",
       "  'photos': [{'height': 2268,\n",
       "    'html_attributions': ['<a href=\"https://maps.google.com/maps/contrib/110341251183134667765\">Joshua Elmer Dungca</a>'],\n",
       "    'photo_reference': 'AXCi2Q5MfTeLf7FACorI5XTlxWwS4AypfcTJ4kFFRZk922b6MMVawZdZndQg92tWUMIdysVxM9TudMI0BtJWYm7nuDsAHDY9h4YLGS8MNdy3ov3FvOKsFJkRMGNwfk3DoAPVAeseLxMh_P8Uz65WdULELRQFlXNZEKeSiYhX4Ctenb_6Ez05',\n",
       "    'width': 4032}],\n",
       "  'place_id': 'ChIJF8c59s-e4jARoz5R8nHRj2Y',\n",
       "  'plus_code': {'compound_code': 'PGWR+J9 Bangkok',\n",
       "   'global_code': '7P52PGWR+J9'},\n",
       "  'rating': 4,\n",
       "  'reference': 'ChIJF8c59s-e4jARoz5R8nHRj2Y',\n",
       "  'scope': 'GOOGLE',\n",
       "  'types': ['lodging', 'point_of_interest', 'establishment'],\n",
       "  'user_ratings_total': 2601,\n",
       "  'vicinity': '99 Ratchadamri Rd, Lumphini, Pathum Wan'},\n",
       " {'business_status': 'OPERATIONAL',\n",
       "  'geometry': {'location': {'lat': 13.7339076, 'lng': 100.5265974},\n",
       "   'viewport': {'northeast': {'lat': 13.73522732989272,\n",
       "     'lng': 100.5279341798927},\n",
       "    'southwest': {'lat': 13.73252767010728, 'lng': 100.5252345201073}}},\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': 'Chatel Bkk',\n",
       "  'opening_hours': {'open_now': True},\n",
       "  'photos': [{'height': 3719,\n",
       "    'html_attributions': ['<a href=\"https://maps.google.com/maps/contrib/106598160335074447056\">A Google User</a>'],\n",
       "    'photo_reference': 'AXCi2Q5XT1UqDzekBotIXdVzCAsxMvwZ34SlJF-d4-vKKbJlYK6AuYmJqNzErrTV0J-6P30JduNShr_gSZ_RKlRAVTcP2dsHvKyg7U5o5dxzGwOthzZXKGPQEsb4JPtyrxyC99H71rhIP_fiypmLgQBvUms1GrsHlNq4CqfcTDngO7MO93x7',\n",
       "    'width': 2479}],\n",
       "  'place_id': 'ChIJFdaF_GSZ4jARuvbTqZTXVDw',\n",
       "  'plus_code': {'compound_code': 'PGMG+HJ Bangkok',\n",
       "   'global_code': '7P52PGMG+HJ'},\n",
       "  'rating': 4.4,\n",
       "  'reference': 'ChIJFdaF_GSZ4jARuvbTqZTXVDw',\n",
       "  'scope': 'GOOGLE',\n",
       "  'types': ['lodging', 'point_of_interest', 'establishment'],\n",
       "  'user_ratings_total': 51,\n",
       "  'vicinity': '1523 Rama IV Rd, Wang Mai, Pathum Wan'},\n",
       " {'business_status': 'OPERATIONAL',\n",
       "  'geometry': {'location': {'lat': 13.7571273, 'lng': 100.5219133},\n",
       "   'viewport': {'northeast': {'lat': 13.75845417989272,\n",
       "     'lng': 100.5233274798927},\n",
       "    'southwest': {'lat': 13.75575452010728, 'lng': 100.5206278201073}}},\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 Suite Hotel',\n",
       "  'opening_hours': {'open_now': True},\n",
       "  'photos': [{'height': 3024,\n",
       "    'html_attributions': ['<a href=\"https://maps.google.com/maps/contrib/114354012153022786846\">A Google User</a>'],\n",
       "    'photo_reference': 'AXCi2Q5UyAkBzi6Mfc9I5YPy7GkFHc6n6x0zOixA7U8iDsmS-vVCFLjTbv6fITGoTHqh2YrsVpm-2fmt6_mwHpjqYPn1We7okIhQRf6Lt3eQNRxOydhhk0Qrf5oT9mvx6WEuSUgOP6tPHPCTxY53z-W9zPZmnLCAWc6WO2mnLkVzL0EG2yny',\n",
       "    'width': 4032}],\n",
       "  'place_id': 'ChIJVZaxPHBvHTERUmo7I6b5kt0',\n",
       "  'plus_code': {'compound_code': 'QG4C+VQ Bangkok',\n",
       "   'global_code': '7P52QG4C+VQ'},\n",
       "  'rating': 3.9,\n",
       "  'reference': 'ChIJVZaxPHBvHTERUmo7I6b5kt0',\n",
       "  'scope': 'GOOGLE',\n",
       "  'types': ['lodging', 'point_of_interest', 'establishment'],\n",
       "  'user_ratings_total': 1306,\n",
       "  'vicinity': '1 Petchburi Road Khwaeng Thung Phaya Thai, Ratchathewi'},\n",
       " {'business_status': 'OPERATIONAL',\n",
       "  'geometry': {'location': {'lat': 13.7469059, 'lng': 100.5488508},\n",
       "   'viewport': {'northeast': {'lat': 13.74826502989272,\n",
       "     'lng': 100.5502038798927},\n",
       "    'southwest': {'lat': 13.74556537010728, 'lng': 100.5475042201073}}},\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': 'Nantra Ploenchit hotel',\n",
       "  'photos': [{'height': 4032,\n",
       "    'html_attributions': ['<a href=\"https://maps.google.com/maps/contrib/112882529924094151036\">112882529924094151036</a>'],\n",
       "    'photo_reference': 'AXCi2Q7GqZhH0esGR-zcPCShb-NTd6lBBLoasdckPbr-FKmo-dFkuY3Zpyh464c4Q5vHz80hqRsc0KGrZrFh0ujJwprqjvF4vY3I7FvLAOoh_cPWoU_a87IRZxhilZ8_6NmtUhIjP8bzsdEQgw66eo19rl77YmxA8cJEcQc2fsbNfboauPDu',\n",
       "    'width': 3024}],\n",
       "  'place_id': 'ChIJEV_8Viqf4jARu_t2Fy_JV1Q',\n",
       "  'plus_code': {'compound_code': 'PGWX+PG Bangkok',\n",
       "   'global_code': '7P52PGWX+PG'},\n",
       "  'rating': 3,\n",
       "  'reference': 'ChIJEV_8Viqf4jARu_t2Fy_JV1Q',\n",
       "  'scope': 'GOOGLE',\n",
       "  'types': ['lodging', 'point_of_interest', 'establishment'],\n",
       "  'user_ratings_total': 202,\n",
       "  'vicinity': '27/12 Soi Nai Loet, Lumphini, Pathum Wan'},\n",
       " {'business_status': 'OPERATIONAL',\n",
       "  'geometry': {'location': {'lat': 13.7300383, 'lng': 100.5311334},\n",
       "   'viewport': {'northeast': {'lat': 13.73128477989272,\n",
       "     'lng': 100.5325170298927},\n",
       "    'southwest': {'lat': 13.72858512010728, 'lng': 100.5298173701073}}},\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': '56 Surawong Hotel Bangkok',\n",
       "  'opening_hours': {'open_now': True},\n",
       "  'photos': [{'height': 1067,\n",
       "    'html_attributions': ['<a href=\"https://maps.google.com/maps/contrib/114284465264360387169\">A Google User</a>'],\n",
       "    'photo_reference': 'AXCi2Q4GgGfJLURqRbHSfZ5MAc1dCZf_NUFv9aJ9yhRd5t7XvuXiUQRLPkXuUYRL3M7GCmx_YbvhRCUDLYwFcMEap9trlMS8W10K6ToaY0HjQFfqgy7g6rJfUYU6-_9nDt_oS9XdS9Pp0nK2x9W0wZ2tpZ5zib1JbOp_h9Zdf4ri4Z-wgfla',\n",
       "    'width': 1600}],\n",
       "  'place_id': 'ChIJOw15HtOY4jARCqQ2iTDgqYc',\n",
       "  'plus_code': {'compound_code': 'PGJJ+2F Bangkok',\n",
       "   'global_code': '7P52PGJJ+2F'},\n",
       "  'rating': 3.9,\n",
       "  'reference': 'ChIJOw15HtOY4jARCqQ2iTDgqYc',\n",
       "  'scope': 'GOOGLE',\n",
       "  'types': ['lodging', 'point_of_interest', 'establishment'],\n",
       "  'user_ratings_total': 228,\n",
       "  'vicinity': '56 Surawong Rd, Silom, Bang Rak'},\n",
       " []]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "def nearby_search(keyword:str, location:str, radius=2000, place_type=None):\n",
    "    # Retrieve the API key from environment variables\n",
    "    api_key = os.getenv('GPLACES_API_KEY')\n",
    "\n",
    "    if not api_key:\n",
    "        raise ValueError(\"API key not found. Please set the GOOGLE_MAPS_API_KEY environment variable.\")\n",
    "\n",
    "    # Define the endpoint URL\n",
    "    url = \"https://maps.googleapis.com/maps/api/place/nearbysearch/json\"\n",
    "\n",
    "    # Set up the parameters for the request\n",
    "    params = {\n",
    "        'keyword': keyword,\n",
    "        'location': location,\n",
    "        'radius': radius,\n",
    "        'type': place_type,\n",
    "        'key': api_key,\n",
    "        \"rankPreference\": \"DISTANCE\"\n",
    "    }\n",
    "\n",
    "    # Send the GET request to the Google Maps API\n",
    "    response = requests.get(url, params=params)\n",
    "\n",
    "    # Check if the request was successful\n",
    "    if response.status_code != 200:\n",
    "        raise Exception(f\"Error with request: {response.status_code}, {response.text}\")\n",
    "\n",
    "    # Parse the JSON response\n",
    "    data = response.json()\n",
    "    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 = \"hotel\"\n",
    "search_results = nearby_search(keyword, location)\n",
    "search_results"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "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': ['<a href=\"https://maps.google.com/maps/contrib/107853816016331257868\">Harshvardhan Mali</a>'],\n",
       "    'photo_reference': 'AXCi2Q7YQKg0xaKoM2A3vnYzyOIQDC5TrsQxNtbyot19fPkxmovfe5guH88XxTEr5R8FCOErr4FCh0o6j1HixapR7hf4vxt-BqYE7pt_5ALwZaeCvO8b7CAtTX6gTmH7euXg0NbxdLQhUE7h_LB2OaUgr4mBnTVHr2d0pnLYOBoPmuSQbIXP',\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': ['<a href=\"https://maps.google.com/maps/contrib/105529198599736349764\">Pathumwan Princess Hotel</a>'],\n",
       "    'photo_reference': 'AXCi2Q5LkQj0Ts-4Sp_GZYboiNY7C5G7Mq6jPeLjvphMxG5T5C-HKDqOHURuvjxIF52_-5BzLu_9QJk0__pY-cizYAN6GoUEpV_busoOGPt67wmF9d-0Xg8ma_61xPbXC1s2oPvqVLTAMO9586thNfnNZZYRsspucrS0xL4m45-0XjknvQPU',\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': ['shopping_mall',\n",
       "   'lodging',\n",
       "   'tourist_attraction',\n",
       "   'restaurant',\n",
       "   'food',\n",
       "   'point_of_interest',\n",
       "   'establishment'],\n",
       "  'user_ratings_total': 7827,\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': ['<a href=\"https://maps.google.com/maps/contrib/101520779225452139808\">Siam Kempinski Hotel Bangkok</a>'],\n",
       "    'photo_reference': 'AXCi2Q7EgE9SGO-SvlsR16qRVmWU6cn3DnYXS9Vc3ee9OegYK0RR9nW3eUEZA03XPAxqb9TurWDybQmlbnzf21ccieSRCGxyPhQjRQG8zySzjWmYA8I-KuTnr1Gnl_LOpmv3d1Q4aHI7SqybBee6mCwiDp4yFlCNzxAgkmn8TmMjEulv4U-_',\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': 5171,\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': ['<a href=\"https://maps.google.com/maps/contrib/108880770713939695570\">Centara Grand &amp; Bangkok Convention Centre at centralwOrld</a>'],\n",
       "    'photo_reference': 'AXCi2Q7Ta6rxawyYVXTRXdSg2x9t-a80ym0BUeS2ypzi8H0zQzUiQh_JpBu_rx2PfIjnMvCEIDbTbJcm-3ra4G9_HbJrTD7wp5y5HWr7Cd2wnedaBck-VuSdEOHwP5NAYJU0qh_2uAUPGXaOME5WepAUjZr5czm5KPHI3U9Q8oMc5Aodw_QW',\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",
       "   'lodging',\n",
       "   'spa',\n",
       "   'restaurant',\n",
       "   'food',\n",
       "   'point_of_interest',\n",
       "   'establishment'],\n",
       "  'user_ratings_total': 6175,\n",
       "  'vicinity': '999, 99 Rama I Road, Khwaeng Pathum Wan, Pathum Wan'},\n",
       " {'business_status': 'OPERATIONAL',\n",
       "  'geometry': {'location': {'lat': 13.750779, 'lng': 100.5306845},\n",
       "   'viewport': {'northeast': {'lat': 13.7521981302915,\n",
       "     'lng': 100.5321781302915},\n",
       "    'southwest': {'lat': 13.7495001697085, 'lng': 100.5294801697085}}},\n",
       "  'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/lodging-71.png',\n",
       "  'icon_background_color': '#909CE1',\n",
       "  'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/hotel_pinlet',\n",
       "  'name': 'Evergreen Place Siam by UHG',\n",
       "  'opening_hours': {'open_now': True},\n",
       "  'photos': [{'height': 4752,\n",
       "    'html_attributions': ['<a href=\"https://maps.google.com/maps/contrib/101915072604208031209\">Evergreen Place Bangkok</a>'],\n",
       "    'photo_reference': 'AXCi2Q4muyWoLyCdS-OALMacN_R7o7xCPoGgvlERfZ_NhHG2HH7J_YieoOxuxELqy974nkWvto5G5y0baqoaIeKnIKjjFD95ztA0XRQNG3-3j6EA435MOmiyHifAZpC5Y-o0Hy4QL7DXWZQ_WMu4ZaL4LjlrdWo75XcO_qnMVPCIK1nghWtU',\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': 2228,\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': ['<a href=\"https://maps.google.com/maps/contrib/102286478336053372469\">The Residence Ratchathewi</a>'],\n",
       "    'photo_reference': 'AXCi2Q40k5jMnJW1S1uGhuZSW94oIfZF8wHpo3Bj6TJC3E4sdysozDQh2lqjxEvpmvAQtGy4Eg6PcTx2HrUUvOIP9Y15DkZFmGn-lMQh8pA5OLCt0GYm06OhU0yQfdXimxI4sf51LoVmCPQe8fmDUslDwGIvofrR_x3JCEP0VCOG0nIkoZwS',\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': ['<a href=\"https://maps.google.com/maps/contrib/115065590130967456230\">Asia Hotel Bangkok</a>'],\n",
       "    'photo_reference': 'AXCi2Q7nMLxEeLXVxZNstAsZ4vDIIYT7CHmklnHs1AAJGRKHwwjF8Blo6GhibN3c1kYltnfCdETbxjybjxNlUCDwOPjUbnsuWWn00LLOxHmr1RxmFgte3N_5yD7NrL7vz3sx_nHorDWjsvlaWS9Hnp1DFUghMBmpOetKLYppCei033sqH4h-',\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': 5468,\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': ['<a href=\"https://maps.google.com/maps/contrib/104545848999971265611\">Novotel Bangkok Platinum Pratunam</a>'],\n",
       "    'photo_reference': 'AXCi2Q6qBZ56Y6UPn9TtOCZxNBKny35eINZpxu6Ll7MarDESm49gmVQxgfnXD8ry7DYY501I4bmEyaocd0DT1oVse5HR4fe5tLL_xfNR5lIvJ1-2MPnjBvFRJaVJ-0URC0xxL808OuQvPtRVGi6oUuMCZ5aG6KAfMUpukCZ7PZFW_Z7zx67e',\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': 4798,\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': ['<a href=\"https://maps.google.com/maps/contrib/114445502763328018172\">MERCURE BANGKOK SIAM</a>'],\n",
       "    'photo_reference': 'AXCi2Q4h4s74XCGAsTARx1UNg18HQj3Zq8H1K-V6fC7bSuPDnIvDt3KCNUokAsMNcYe51GuFfrI6HzgnOMTbsS2H8R2vNdV2ux_A2VJQiNT2L7Np-M_gTDIUbYlD_uvyJDZQ-Pd3PknEz4x64mInT25nsq_R6YTq1ZvcrHiy0XZCl1lqX6Al',\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': 2243,\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': ['<a href=\"https://maps.google.com/maps/contrib/115552232905673664668\">มิสสยาม โรงแรมหัวช้าง เฮอริเทจ</a>'],\n",
       "    'photo_reference': 'AXCi2Q6Sbu_BgfBc6TSf5sOYIsTgC8JzttjJIuMgMwsTHAOhwCq-d1QOPKbtwbBNLLS0dfVXu4XHqkYBLYab0AEBtTa59con0Gw2L4F3MgQfjw_Y0mF9R9XgKFHdXMn0XZgyqlEpby-wswex8VgXV-dn9k_eequgTZuuZfGyDGhYsT1C3sYl',\n",
       "    'width': 4271}],\n",
       "  'place_id': 'ChIJUUD5KBOZ4jAR0QLGy07t3BQ',\n",
       "  'plus_code': {'compound_code': 'PGXJ+G8 Bangkok, Thailand',\n",
       "   'global_code': '7P52PGXJ+G8'},\n",
       "  'rating': 4.3,\n",
       "  'reference': 'ChIJUUD5KBOZ4jAR0QLGy07t3BQ',\n",
       "  'scope': 'GOOGLE',\n",
       "  'types': ['lodging', 'point_of_interest', 'establishment'],\n",
       "  'user_ratings_total': 1056,\n",
       "  'vicinity': '400 Phaya Thai Road, Khwaeng Wang Mai, Pathum Wan'},\n",
       " {'business_status': 'OPERATIONAL',\n",
       "  'geometry': {'location': {'lat': 13.7417243, 'lng': 100.5410489},\n",
       "   'viewport': {'northeast': {'lat': 13.7429306802915,\n",
       "     'lng': 100.5424668802915},\n",
       "    'southwest': {'lat': 13.7402327197085, 'lng': 100.5397689197085}}},\n",
       "  'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/lodging-71.png',\n",
       "  'icon_background_color': '#909CE1',\n",
       "  'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/hotel_pinlet',\n",
       "  'name': 'Grande Centre Point Ratchadamri',\n",
       "  'opening_hours': {'open_now': True},\n",
       "  'photos': [{'height': 1999,\n",
       "    'html_attributions': ['<a href=\"https://maps.google.com/maps/contrib/106290596075567109314\">Grande Centre Point Ratchadamri</a>'],\n",
       "    'photo_reference': 'AXCi2Q53dAR1e3p0YCUsrw--FQNC6neK_zSj7XU5g_tc21UVLf8VbQjX9rPnjq-gdyQa-kzRV9RD-X3Eg9uzoiTU8VAjQ0NioZH_MPqfSwAF2elwNdMZZH24hWmkkf5GnZmx0bZLRjKQjF-dITj_EnIYP9Extu-HmFIOlDENhXuD4t1o89JA',\n",
       "    'width': 3214}],\n",
       "  'place_id': 'ChIJMckScdqe4jARnCUZdPKRjF8',\n",
       "  'plus_code': {'compound_code': 'PGRR+MC Bangkok, Thailand',\n",
       "   'global_code': '7P52PGRR+MC'},\n",
       "  'rating': 4.5,\n",
       "  'reference': 'ChIJMckScdqe4jARnCUZdPKRjF8',\n",
       "  'scope': 'GOOGLE',\n",
       "  'types': ['lodging', 'point_of_interest', 'establishment'],\n",
       "  'user_ratings_total': 3963,\n",
       "  'vicinity': '153, 2 Thanon Ratchadamri, Khwaeng Lumphini, Pathum Wan'},\n",
       " {'business_status': 'OPERATIONAL',\n",
       "  'geometry': {'location': {'lat': 13.7468712, 'lng': 100.52869},\n",
       "   'viewport': {'northeast': {'lat': 13.7481022302915,\n",
       "     'lng': 100.5300163302915},\n",
       "    'southwest': {'lat': 13.7454042697085, 'lng': 100.5273183697085}}},\n",
       "  'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/lodging-71.png',\n",
       "  'icon_background_color': '#909CE1',\n",
       "  'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/hotel_pinlet',\n",
       "  'name': 'Lub d Bangkok Siam',\n",
       "  'opening_hours': {'open_now': False},\n",
       "  'photos': [{'height': 4000,\n",
       "    'html_attributions': ['<a href=\"https://maps.google.com/maps/contrib/110664455171949656649\">Lub d Bangkok Siam</a>'],\n",
       "    'photo_reference': 'AXCi2Q7qVqiYRLZVt_dOCtImxbBVKNRmBCSzQ2v--5_YEibb3-6bO79iKRmn_LlFv1AvQ1K2hl5j24-PQYHJD5KC48NeZ-lFx5yvpYlQ41WJqpHoNc2TFIC-NGH61WnCnofVXvKh4xG1v-1N1dGqXG0ote0-VaxF3VJB5EqX8c4ePn4GdozI',\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': ['<a href=\"https://maps.google.com/maps/contrib/112525229722496996483\">VIE Hotel Bangkok - MGallery</a>'],\n",
       "    'photo_reference': 'AXCi2Q7TveQ9nEBfcLD4-zSxR0YKeU9Dds7U8lV-Uq6Dqn_lE-cEGoRo4f8EU_W8AMOqKB3Sd2Q67lWjdRhwXG0EhZ1SCwJlzv6ScLyvCjB_p1fhFL3CZP8BiwFzBO6pwMKp3FDXGjxv4MxuJNuCf6Dhy1q9Evyn8L4jbGIM5drEAcX0Uo5E',\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': 2352,\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': ['<a href=\"https://maps.google.com/maps/contrib/110177766871190441187\">The St. Regis Bangkok</a>'],\n",
       "    'photo_reference': 'AXCi2Q5MpeB0BkgSi1uUIdWT8oWziRVQEpZPeqwJw3RnzXL5wTAGgaAHsu8pfR1o1S9FvfSopFMe6HpmGOi7YCkazz5svGa4JhciyaT2T6eojpXkrKBYD_z1RLgn8bp7-TH4ewCyf8oWioRrKLfoPh3iNQGWi7QG3GrmLoCP_5cIIyfDCLaE',\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': 3163,\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': ['<a href=\"https://maps.google.com/maps/contrib/100808819005846466311\">Aisyah Hassan</a>'],\n",
       "    'photo_reference': 'AXCi2Q4sZM83sIM9mOC6Idg-_kdWyCGM1YUHs2DaEeVeKDj5lteFPpbTIFAA60Y90LUX3iu75-bhCiCzUNg5-c9jlQiQJ6aSH3KIJasgs0UUh6NZU0wf0ho07k-FUoj-DrnK5kHmfF_H1IU3HKTzJCZJ4hxEMIYXAGeyYdezcGHRwwtb5j-R',\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': ['<a href=\"https://maps.google.com/maps/contrib/115779328569151334983\">The Twin Towers Hotel</a>'],\n",
       "    'photo_reference': 'AXCi2Q5zHHC0HBwk7iR-m5-0F2QtmYVNs16ziY8g9zRKH_ViPHjqvPvE-n5JvuJT-Kjnh3_YoghMyn-SoriXMXxPpNySIw3sP1TjZ5BI8lRC2OVN_b6h3HPUYba9CWzJXn_-320Oho3XGZ-yr54y1t7G4j84SpmWzbwItgY-XmbnlWO36J2m',\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': ['<a href=\"https://maps.google.com/maps/contrib/106256908812849161304\">Anantara Siam Bangkok Hotel</a>'],\n",
       "    'photo_reference': 'AXCi2Q6Rc9MGEhM1NGsPvYYoZ7dAi-hedtt97CrRjslZnsfwqbiEE0UkewPBEkVeY7l7QR4-WRlViax1KeVavFPnY7fa4TW6j0ccEY4fHqxifBSHlhDyA-rKK7uDoxsiUqSOfDJfMtxdUSN6jSRmArsILOdOxX6zz_50G5PAjuJA_nFbYocP',\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': ['lodging',\n",
       "   'spa',\n",
       "   'restaurant',\n",
       "   'food',\n",
       "   'point_of_interest',\n",
       "   'establishment'],\n",
       "  'user_ratings_total': 5380,\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': False},\n",
       "  'photos': [{'height': 2340,\n",
       "    'html_attributions': ['<a href=\"https://maps.google.com/maps/contrib/104261864986023217768\">S. Ibrahim Nst.</a>'],\n",
       "    'photo_reference': 'AXCi2Q5Nr0zE2yKY2Pkr89GsijyiE6eQyJ-A5-5AD7JGZhVrzp0_8QjBXaQjQFPCpnEZPL_9EK_fwCiIG6IBmlOjWAQqKcfL81Czkc3b1BDhi9rV-x7_SIuThzhLYsC6utnrTtIqJ6aepwquDJ05BtMjuhe8th8h2GJE8RKPGjjF0LrMtR-I',\n",
       "    'width': 4160}],\n",
       "  'place_id': 'ChIJgUSJZM2e4jAREnHS1rSuWRk',\n",
       "  'plus_code': {'compound_code': 'PGWJ+PG Bangkok, Thailand',\n",
       "   'global_code': '7P52PGWJ+PG'},\n",
       "  'rating': 4.4,\n",
       "  'reference': 'ChIJgUSJZM2e4jAREnHS1rSuWRk',\n",
       "  'scope': 'GOOGLE',\n",
       "  'types': ['shopping_mall', 'point_of_interest', 'establishment'],\n",
       "  'user_ratings_total': 18880,\n",
       "  'vicinity': '194 Phaya Thai Road, Khwaeng Pathum Wan, Pathum Wan'},\n",
       " {'business_status': 'OPERATIONAL',\n",
       "  'geometry': {'location': {'lat': 13.7481275, 'lng': 100.5414289},\n",
       "   'viewport': {'northeast': {'lat': 13.7494722302915,\n",
       "     'lng': 100.5427770802915},\n",
       "    'southwest': {'lat': 13.7467742697085, 'lng': 100.5400791197085}}},\n",
       "  'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/lodging-71.png',\n",
       "  'icon_background_color': '#909CE1',\n",
       "  'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/hotel_pinlet',\n",
       "  'name': 'Aphrodite Inn Bangkok',\n",
       "  'opening_hours': {'open_now': True},\n",
       "  'photos': [{'height': 1280,\n",
       "    'html_attributions': ['<a href=\"https://maps.google.com/maps/contrib/104889790730167599680\">Aphrodite Inn Bangkok</a>'],\n",
       "    'photo_reference': 'AXCi2Q6EEQ1eZIsi5DslFbjDTEOZApqtYIjZv48JZwNnHCbKRK8cPFGbQod8Iavt8Vb6jt7UCAgUyjLOID96NsRtVMN77VFFmvmL5gR7FxV2Sq7jZfRQacYxeKKDh1gLikbVZ76Qe0r5rbxHP734MmhfpULIWTCXc8Z68JUz1yTBUCoy57wL',\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': ['<a href=\"https://maps.google.com/maps/contrib/118254622117013496228\">Nakorn Chong</a>'],\n",
       "    'photo_reference': 'AXCi2Q6nWG-gVdJIY_3aZwHHeEunCwUQasXaWepe4x_Iy8OvLh53nKVv_RCoDR6QsnDvAqI94qcMrrcFS8ysjH_LktZ54BVkISzB7-qPUkQeW_OWsLDMFvbm59cAV8nKDhSRIhuP0e9X1cClvOdXpAowEPNUMnwVvnrao82p637ynK2OCmFS',\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": 8,
     "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
}