Google Place API を使って キーワード検索をする [PHP]

公開日:2017/07/01  最終更新日:2018/05/02  カテゴリー:未分類

Google Place API は 一定リクエスト回数までは 無料で利用でき、データ用も多いのでとても役に立ちそうなAPIです。
そんな Plae API について 実際のコードを交えながら、初心者の私が 初心者の方にも分かりやすいように説明したいと思います。

場所の検索方法について

Google Place API には 次の 検索方法が用意されています。
どの検索方法でも キーワード・位置情報を両方とも指定できますが、それらの優先度や必須項目が異なります。

名称 必須項目 特徴
周辺検索 位置座標 位置情報を基に検索を行う。キーワードなどによる絞り込みも可能。
テキスト検索 キーワード キーワードを基に検索を行う。位置情報などによる絞り込みも可能。
レーダー検索 位置情報 検索精度は落ちるが 200件までの位置情報が取得可能。

今回は テキスト検索を用いた方法を紹介します。

前提条件

本記事では 技術的なことを中心にまとめるため、APIを利用するための アプリケーションは 作成済みという前提で進めます。
未だの方は 作成してから この記事に戻ってきていただければ幸いです。
(そのうち アプリケーションの作成手順も記事にしたいとは思っています。)

リクエスト方法

次のURLでテキスト検索をリクエストできます。
https://maps.googleapis.com/maps/api/place/nearbysearch/output?parameters

output について

json (推奨) と xml から出力形式を選択できます。
後から示すサンプルでは jsonを用いたものになっています。

parameters について

ややこしいので サポート終了したものを除いて紹介します。

キー必須内容サンプルでの値
query キーワード 日本大使館
key アプリケーションのAPIキー (非公開)
location × 位置情報 (省略)
radius × 優先表示する半径 (省略)
language × 優先表示する言語 (省略)
minprice/maxprice × 価格帯:0(最も安い)〜4(最も高い) (省略)
opennow × 営業中の店舗のみを表示 (省略)
pagetoken × 20件以上のデータ取得/ページング処理を行うときに使用 (省略)

実際のコード

<?php

function searchPlace($keyword) {
	$api_key = "【あなたのAPIキー】";
	$keyword = urlencode($keyword);
	$url = "https://maps.googleapis.com/maps/api/place/textsearch/json?key={$api_key}&query={$keyword}";
	$json = file_get_contents($url);
	return json_decode($json, true);
}

print_r(searchPlace("日本大使館"));

?>

解説: 5行目 urlencode()

これをつけない方も多いですが、これが無いと空白を含む検索をしたときにエラーになります。

その他

出力時には htmlspecialchars() などを通した方がよいでしょう。

解説: 8行目 json_decode()

この関数で json をデコードしています。
第2因数に true を指定することで 配列が返るようになります。

実際のレスポンス

上記コードのように 「日本大使館」を検索すると、以下のような 結果が返ってきました。
「日本大使館」では いい感じに複数のデータが返ってきますが、「空港」と検索すると 1件しか返ってきません...。

Array
(
    [html_attributions] => Array
        (
            [0] => Listings by <a href="http://www.where-in-thailand.com/">Where In Thailand</a>
        )

    [next_page_token] => CvQB4gAAAC_AGjSe_As5D-LYcL5FwrMh49S92Mjm2LljHSxwhhWuJMgude84KY9oFyYKlP0ADH3sPmhDIwrrJlWtaPguMBEQNr-VchC17qeCpkCEC5Wd9kESHHjVsgyHwlyJdkao7Vhl8nNvdBWXIU3q4RPpj6G9LtRUoMsYftS_oqMj99GPSJG5sOU5S4nwc259Aru9v9t2lWGxDL33Zplt1dS3LkirAwpgLkXJM8Lxneyeu2uke4_lkI4il1Ll03TZGGbbpedgSxzJI4RXqo1ORRk0APjTo8RknFODuqjaJPUFMxsZTehZ7UQTWbirOugx1TBZXRIQWLP28CNHuOgfcvmgUOeFjhoUcrk1th-l1peCl_z9cY_0m4NoFNs
    [results] => Array
        (
            [0] => Array
                (
                    [formatted_address] => 2-2-1 Azabudai, 港区 東京都 106-0041, Japan
                    [geometry] => Array
                        (
                            [location] => Array
                                (
                                    [lat] => 35.6578031
                                    [lng] => 139.7419704
                                )

                            [viewport] => Array
                                (
                                    [northeast] => Array
                                        (
                                            [lat] => 35.6591520803
                                            [lng] => 139.74331938
                                        )

                                    [southwest] => Array
                                        (
                                            [lat] => 35.6564541197
                                            [lng] => 139.74062142
                                        )

                                )

                        )

                    [icon] => https://maps.gstatic.com/mapfiles/place_api/icons/civic_building-71.png
                    [id] => c6d719767a9aaa87adf5745814ebf56fbddaab5d
                    [name] => 在日本アフガニスタン大使館
                    [photos] => Array
                        (
                            [0] => Array
                                (
                                    [height] => 1944
                                    [html_attributions] => Array
                                        (
                                            [0] => <a href="https://maps.google.com/maps/contrib/108784195876784182303/photos">バーン</a>
                                        )

                                    [photo_reference] => CmRaAAAAuMlHYtsXHMpJ4L0JF5uaY0F9fvc3jvR0sjSjX3SSCQyvE_fitR5UAuBWfw0THHT974l7Cay_d0Z1xCNBRXfIK9CAh_xSCJNjbDdRLcEoa226qkEUl1KcHfiFyc-y_QnFEhA4x_LHSBqgQLUZx2-dGzTRGhRWl5Z7ckrEX94hn15Wl-FAkV9ltA
                                    [width] => 2592
                                )

                        )

                    [place_id] => ChIJOZPMAZiLGGARg0LdNTvBDbA
                    [rating] => 4.4
                    [reference] => CmRSAAAArr1GcvGNuysa84dE8mcrcLgL5bOrmVqNoAMGNQ1xTS1Bf113bnWUV7N-xkG2xc_T5j5b2tTMYZ5FzAQsWbNq57jzp_ZII-yPsKfRRBknTLqcFaUdPo4T60se9RSUFUDEEhD9VyVrUgJSFLMXyfBXao3VGhRqSRL57_kXS3Jm6VYDRdugXIaZTA
                    [types] => Array
                        (
                            [0] => embassy
                            [1] => point_of_interest
                            [2] => establishment
                        )

                )

            [1] => Array
                (
                    [formatted_address] => 18 Gogwan-ro, Dong-gu, Busan, South Korea
                    [geometry] => Array
                        (
                            [location] => Array
                                (
                                    [lat] => 35.1212553
                                    [lng] => 129.0424796
                                )

                            [viewport] => Array
                                (
                                    [northeast] => Array
                                        (
                                            [lat] => 35.1226042803
                                            [lng] => 129.04382858
                                        )

                                    [southwest] => Array
                                        (
                                            [lat] => 35.1199063197
                                            [lng] => 129.04113062
                                        )

                                )

                        )

                    [icon] => https://maps.gstatic.com/mapfiles/place_api/icons/civic_building-71.png
                    [id] => 1e51c3263b7c902c4f3245154cba548f2276e857
                    [name] => Consulate-General of Japan in Busan
                    [opening_hours] => Array
                        (
                            [open_now] => 
                            [weekday_text] => Array
                                (
                                )

                        )

                    [place_id] => ChIJ1cogrdvraDUROJD4IZ7LFIA
                    [rating] => 4
                    [reference] => CmRSAAAASKfTrhg9SEAnsEQ6pbJfjRrEQsA-KYwA3_mUvA5KNDh3jd2z0Qxyo_Tru2o5YpeRqSzUqWYUF8I9rLBVxUppg6KDFpN1clIE-nnUP3ipQ2qPfJX0P_gLmdzpB9ZE5k9tEhB-m9Zl2hZz1efzHzwar2o1GhRKwo4QWhSMpxpYRFKVHds_X3Y2jA
                    [types] => Array
                        (
                            [0] => embassy
                            [1] => point_of_interest
                            [2] => establishment
                        )

                )

            [2] => Array
                (
                    [formatted_address] => 3 Chome-4-33 Motoazabu, Minato, Tokyo 106-0046, Japan
                    [geometry] => Array
                        (
                            [location] => Array
                                (
                                    [lat] => 35.6562898
                                    [lng] => 139.7272209
                                )

                            [viewport] => Array
                                (
                                    [northeast] => Array
                                        (
                                            [lat] => 35.6576387803
                                            [lng] => 139.72856988
                                        )

                                    [southwest] => Array
                                        (
                                            [lat] => 35.6549408197
                                            [lng] => 139.72587192
                                        )

                                )

                        )

                    [icon] => https://maps.gstatic.com/mapfiles/place_api/icons/civic_building-71.png
                    [id] => ccf2e60b8d0a8e83b33407562962a61e961db877
                    [name] => 中華人民共和国駐日本国大使館
                    [opening_hours] => Array
                        (
                            [open_now] => 
                            [weekday_text] => Array
                                (
                                )

                        )

                    [photos] => Array
                        (
                            [0] => Array
                                (
                                    [height] => 1936
                                    [html_attributions] => Array
                                        (
                                            [0] => <a href="https://maps.google.com/maps/contrib/109420076565040729976/photos">patriot red</a>
                                        )

                                    [photo_reference] => CmRaAAAALBQTI7Aq80w-vhPEEuEj0uF5Nq0QjsE-I0LnyeaeD6gNrTItOBLhgmCi_8gOb_huX5ydGGiyL_RUxmYy_JhJnsHVf3HnEcVcso1yh9toJyLg4HlLs715IiQXB7033BNkEhDnkU7QG60n2ycpEu-_gHiTGhRzke66RZzSy2oMN4pCWohvKhbz-Q
                                    [width] => 2592
                                )

                        )

                    [place_id] => ChIJt3ocBHSLGGAReEK62GRyKOk
                    [rating] => 3.1
                    [reference] => CmRSAAAA5VfdVJ9drZ868jjACEXb-zc2HDnFdZAh40ZSQTuEZZ0K6llMNbvGE_T5aAIXnqxHy60vyIlifJETJF_nHRAtylP9A6PaSQ3p7XJG3zlJCICD_lSiZ4krY_tpXIq7xgvAEhDDBakeKslBHqf296r_6e6-GhTFtpK9futysjOMC6BkeYGB9MOoLg
                    [types] => Array
                        (
                            [0] => embassy
                            [1] => point_of_interest
                            [2] => establishment
                        )

                )

            [3] => Array
                (
                    [formatted_address] => 3 Chome-6-3 Shibakoen, Minato, Tokyo 105-0011, Japan
                    [geometry] => Array
                        (
                            [location] => Array
                                (
                                    [lat] => 35.6617619
                                    [lng] => 139.7458163
                                )

                            [viewport] => Array
                                (
                                    [northeast] => Array
                                        (
                                            [lat] => 35.6631108803
                                            [lng] => 139.74716528
                                        )

                                    [southwest] => Array
                                        (
                                            [lat] => 35.6604129197
                                            [lng] => 139.74446732
                                        )

                                )

                        )

                    [icon] => https://maps.gstatic.com/mapfiles/place_api/icons/civic_building-71.png
                    [id] => ae78803c1edc531654c74f9234f29a6deb1bb7e3
                    [name] => 駐日オランダ王国大使館
                    [opening_hours] => Array
                        (
                            [open_now] => 
                            [weekday_text] => Array
                                (
                                )

                        )

                    [photos] => Array
                        (
                            [0] => Array
                                (
                                    [height] => 2592
                                    [html_attributions] => Array
                                        (
                                            [0] => <a href="https://maps.google.com/maps/contrib/102943771504871687371/photos">Светлана Давыдова</a>
                                        )

                                    [photo_reference] => CmRaAAAANVLUB27ezDQbBEo2n-Q5Hb_p8kRhAODky84F4BQkOJQ2Yrwc2pSTUhCxFJOX1hO1ZyfakHAgMcBHoV06a5Z_IWH555hR_8ezXKSU4CQpA_pc-awD4NtHPT3UiqIcrSeCEhDITx6zJiPSwwoJf6kbLJG_GhQIkToTk2iMQAYYQ5MrosohWOf9HA
                                    [width] => 1936
                                )

                        )

                    [place_id] => ChIJO_dmX5aLGGARH1roCgFn-uE
                    [rating] => 3.7
                    [reference] => CmRSAAAAoVvwIXjkOoZx91T6N37ykAwGbiCDeaYwQFLD_jW_3zHszutZuwTyu8mdrHu0wvTBHHGrchV2x_epMo2nYI1rXgwOy4KXxCM2toJIMcClXSXcEVXyIsYWWDGzFpjDGOFPEhB3R2cCTNm-16gEjmHA65-sGhSrphYszYj_Z87aSBEUnvL5qrJFug
                    [types] => Array
                        (
                            [0] => embassy
                            [1] => point_of_interest
                            [2] => establishment
                        )

                )

            [4] => Array
                (
                    [formatted_address] => Japan, 〒102-8381 Tokyo, Chiyoda, Ichibancho, 1
                    [geometry] => Array
                        (
                            [location] => Array
                                (
                                    [lat] => 35.6868773
                                    [lng] => 139.7442973
                                )

                            [viewport] => Array
                                (
                                    [northeast] => Array
                                        (
                                            [lat] => 35.6882262803
                                            [lng] => 139.74564628
                                        )

                                    [southwest] => Array
                                        (
                                            [lat] => 35.6855283197
                                            [lng] => 139.74294832
                                        )

                                )

                        )

                    [icon] => https://maps.gstatic.com/mapfiles/place_api/icons/civic_building-71.png
                    [id] => 50811a0cd50d18fa5d97c5a6b23d9cae0ecb4f1a
                    [name] => 駐日英国大使館
                    [photos] => Array
                        (
                            [0] => Array
                                (
                                    [height] => 1151
                                    [html_attributions] => Array
                                        (
                                            [0] => <a href="https://maps.google.com/maps/contrib/109098721967875570242/photos">Chung-Yu Lee</a>
                                        )

                                    [photo_reference] => CmRaAAAAYtGyS8P0uZWbE0WYkJFXFIEoujPyBBa3zQYFVhXst6UOJMveewO1wt-3NsQc_yo2yIpRqwTdnSlDXRCABD80rXezaymRA3nNdq1d8DmanSRQoexRzCiW3VWmmLESpXgMEhCldU54mRYDR5WCfSDD0MaGGhQCTU18llYQGOFeNWYT5D_5hOdXYQ
                                    [width] => 2048
                                )

                        )

                    [place_id] => ChIJIbS7comLGGARaYikfZrnS8c
                    [rating] => 3.9
                    [reference] => CmRSAAAAacuEmo6vpl6PRBSmCPoNNOgu_BLwtPqMEWkh3oFgQ90qIESO6R1UwMQJgZ8cG2MB9g-FjMnjaI4C6TKq5qDf1_zFbRuJtnNdPYfu-WG4RX7GK8iNc1PhAqJRbp5nipmwEhCBxFDpk0fWuwPk0Ch4MZZDGhRWfbCqm4HuTpgMvfm3TFtuHS6LuQ
                    [types] => Array
                        (
                            [0] => embassy
                            [1] => point_of_interest
                            [2] => establishment
                        )

                )

            [5] => Array
                (
                    [formatted_address] => Japan, 〒107-8420 東京都港区赤坂1−10−5
                    [geometry] => Array
                        (
                            [location] => Array
                                (
                                    [lat] => 35.6688048
                                    [lng] => 139.743326
                                )

                            [viewport] => Array
                                (
                                    [northeast] => Array
                                        (
                                            [lat] => 35.6701537803
                                            [lng] => 139.74467498
                                        )

                                    [southwest] => Array
                                        (
                                            [lat] => 35.6674558197
                                            [lng] => 139.74197702
                                        )

                                )

                        )

                    [icon] => https://maps.gstatic.com/mapfiles/place_api/icons/civic_building-71.png
                    [id] => b38c48a7c0a055662036845c1efd1b9c942d8889
                    [name] => 在日米国大使館
                    [opening_hours] => Array
                        (
                            [open_now] => 
                            [weekday_text] => Array
                                (
                                )

                        )

                    [photos] => Array
                        (
                            [0] => Array
                                (
                                    [height] => 800
                                    [html_attributions] => Array
                                        (
                                            [0] => <a href="https://maps.google.com/maps/contrib/116321730612965563029/photos">Platea U</a>
                                        )

                                    [photo_reference] => CmRaAAAAQfQ7FrQUQOq8NbgCERAf0V1tB568vfvdqzcHrpdq9-CR7_sE7_byjWUVxz0ADMa8Z6i9bEv9T4rHtpDECkq8bDtZoRyK6_kd_3d7Qlo7uh5COYU6l86flXvGTLquMFusEhDLwN56hGB_56KEZ2FjH8zfGhQnfQP4ZO5OSpYRsHlRoWxQkAo83g
                                    [width] => 1200
                                )

                        )

                    [place_id] => ChIJ9_kp64-LGGARXqik14nBLBA
                    [rating] => 3.7
                    [reference] => CmRRAAAAvrNJAlO2UsHO9EpbvPjfdW1R_uK-63C1C0HS54MUEW-CFavpnhZosdE8iqAaZNlWBHx1AWfF5d5Vfiz__qcAvV71siRwhLRyMRijVyYzJxv9TxpjOxyyrihLYPtRxNLdEhBfNwafsvJ0F2EqS1LJ_ZkfGhR3ksfEMYCiPfL5eOQFYixpd5wj0A
                    [types] => Array
                        (
                            [0] => embassy
                            [1] => point_of_interest
                            [2] => establishment
                        )

                )

            [6] => Array
                (
                    [formatted_address] => 2 Chome-2-11 Kudanminami, 千代田区 Tokyo 102-0074, Japan
                    [geometry] => Array
                        (
                            [location] => Array
                                (
                                    [lat] => 35.693955
                                    [lng] => 139.747162
                                )

                            [viewport] => Array
                                (
                                    [northeast] => Array
                                        (
                                            [lat] => 35.6953039803
                                            [lng] => 139.74851098
                                        )

                                    [southwest] => Array
                                        (
                                            [lat] => 35.6926060197
                                            [lng] => 139.74581302
                                        )

                                )

                        )

                    [icon] => https://maps.gstatic.com/mapfiles/place_api/icons/civic_building-71.png
                    [id] => f7d29334079bfa17ace214e28bc12fd4f2320445
                    [name] => 駐日インド大使館
                    [opening_hours] => Array
                        (
                            [open_now] => 
                            [weekday_text] => Array
                                (
                                )

                        )

                    [photos] => Array
                        (
                            [0] => Array
                                (
                                    [height] => 2448
                                    [html_attributions] => Array
                                        (
                                            [0] => <a href="https://maps.google.com/maps/contrib/103306407965773157228/photos">M Street View</a>
                                        )

                                    [photo_reference] => CmRaAAAAbVUyp3-5eAwaCZSyn2kzeSsODP8ObEMNR_QnWkbQbLTYGyPJJve7CFNwaX3Bf4bivrmU-AE1T2oprH6YfY1imhwj_Zbn1NiMYXqDLVBLPXPLXdA9cc2n62lBi4EnKT17EhDy2Vo_UZGTXtCa-rBY_i1uGhQUf_wY_bwg5w0hLkiQRbB8qV-0bQ
                                    [width] => 3264
                                )

                        )

                    [place_id] => ChIJdbux1WKMGGARkDHGl4CaVWI
                    [rating] => 3.4
                    [reference] => CmRRAAAA6C-AnjM4SkIgNzxlfrEGP3Ny0RsaZJycnCL1hNdaJBXii4T2wF67Djx5S_cus5TS6Zar8Vf4DT9C6D5uSAp9WHkSMdtuv56Ob6jZpDX9W22KoXwta_Y-nqOMUYTvEtndEhCqyK6HlLC75Fjwq1iKO4RxGhS3ZBZsePZS42eptk7mv-JXJB7xPg
                    [types] => Array
                        (
                            [0] => embassy
                            [1] => point_of_interest
                            [2] => establishment
                        )

                )

            [7] => Array
                (
                    [formatted_address] => 21-4 Kamiyamacho, 渋谷区 Tokyo 150-0047, Japan
                    [geometry] => Array
                        (
                            [location] => Array
                                (
                                    [lat] => 35.6622574
                                    [lng] => 139.6890186
                                )

                            [viewport] => Array
                                (
                                    [northeast] => Array
                                        (
                                            [lat] => 35.6636063803
                                            [lng] => 139.69036758
                                        )

                                    [southwest] => Array
                                        (
                                            [lat] => 35.6609084197
                                            [lng] => 139.68766962
                                        )

                                )

                        )

                    [icon] => https://maps.gstatic.com/mapfiles/place_api/icons/civic_building-71.png
                    [id] => 1ce35c5af61b542635c2aa89229202eb91c8dab2
                    [name] => 駐日モンゴル国大使館
                    [opening_hours] => Array
                        (
                            [open_now] => 
                            [weekday_text] => Array
                                (
                                )

                        )

                    [photos] => Array
                        (
                            [0] => Array
                                (
                                    [height] => 1536
                                    [html_attributions] => Array
                                        (
                                            [0] => <a href="https://maps.google.com/maps/contrib/109455260799956731370/photos">mashio yatsuzuka</a>
                                        )

                                    [photo_reference] => CmRaAAAAvLxZlGydCFE7orHEIGTbK9D50JmO5T_Ixfcx-n0tuvizGoFIX2lC5Mw2rA3p5TKRRMyc3GrZ3oL2D4aMcRDSH029K3x5oqQ3JWgESv_p9DDI3aBtzLdF-iwOXeSq8wuyEhBZuZkNP6isF6zjgDqumngKGhS0eNDicisc1wRcpwKkFc2edmflyw
                                    [width] => 2048
                                )

                        )

                    [place_id] => ChIJd8KP-1LzGGARc9bGalj7C4s
                    [rating] => 3.2
                    [reference] => CmRSAAAA72njeksKwXXvD3sm88X6O-UtJmfRFm5HlpxIT8iPdH1cia6sk7Vy1JhYmfWw_XMZ-KbZuQiZ58v1rdyChoD-VIget6tXtLJ6XT1jPDzEgoyib1vXjZzKqcdT-T4X0tQeEhBcR7DGAlrOHcZ3EXMY_ZeXGhRtF6FYK9fY3ud84jzFwNX7SsM1sw
                    [types] => Array
                        (
                            [0] => embassy
                            [1] => point_of_interest
                            [2] => establishment
                        )

                )

            [8] => Array
                (
                    [formatted_address] => Japan, 〒100-0011 Tokyo, Chiyoda, 内幸町2丁目2−1 日本プレスセンタービル2階
                    [geometry] => Array
                        (
                            [location] => Array
                                (
                                    [lat] => 35.6709194
                                    [lng] => 139.7542041
                                )

                            [viewport] => Array
                                (
                                    [northeast] => Array
                                        (
                                            [lat] => 35.6722683803
                                            [lng] => 139.75555308
                                        )

                                    [southwest] => Array
                                        (
                                            [lat] => 35.6695704197
                                            [lng] => 139.75285512
                                        )

                                )

                        )

                    [icon] => https://maps.gstatic.com/mapfiles/place_api/icons/civic_building-71.png
                    [id] => 0bbe874cb94ed982cc2d17ab6f2b3766976a71c2
                    [name] => モンテネグロ名誉領事館
                    [place_id] => ChIJq9sobe2LGGAR7Z0c_mFwPtM
                    [reference] => CmRSAAAAqBu8MHdnv1EBluoyoUkyA7snq7F9K_vOVjen5Lt9DiYzq2rTEgawgD_2hYQ1LwLmguCvNRlrJBtItO-B6tE7JySSbafpyMey3HjI9j-u1en2myrB2dKTuZvB2mzcg28vEhDT7yv6wLGfYAVuY_LnWTn4GhS9BaNE6IVlFqk6jGCugGWZjF8H1A
                    [types] => Array
                        (
                            [0] => embassy
                            [1] => point_of_interest
                            [2] => establishment
                        )

                )

            [9] => Array
                (
                    [formatted_address] => 7 Chome-3-38 Akasaka, Minato, Tokyo 107-0052, Japan
                    [geometry] => Array
                        (
                            [location] => Array
                                (
                                    [lat] => 35.6733488
                                    [lng] => 139.7285577
                                )

                            [viewport] => Array
                                (
                                    [northeast] => Array
                                        (
                                            [lat] => 35.6746977803
                                            [lng] => 139.72990668
                                        )

                                    [southwest] => Array
                                        (
                                            [lat] => 35.6719998197
                                            [lng] => 139.72720872
                                        )

                                )

                        )

                    [icon] => https://maps.gstatic.com/mapfiles/place_api/icons/civic_building-71.png
                    [id] => a280025bd97d2e6d112646060c45db2412a9d3ca
                    [name] => 在日カナダ大使館
                    [opening_hours] => Array
                        (
                            [open_now] => 
                            [weekday_text] => Array
                                (
                                )

                        )

                    [photos] => Array
                        (
                            [0] => Array
                                (
                                    [height] => 1536
                                    [html_attributions] => Array
                                        (
                                            [0] => <a href="https://maps.google.com/maps/contrib/107410619814173255599/photos">Julien Leblond</a>
                                        )

                                    [photo_reference] => CmRaAAAAv-TB3bhfuDx4JEGwsB5MQjeMgfIbSfpcbZfzFFzoeUEH91wdc2FZ6J5DU77W8EffK_6fkW-P3fL4YyrJ2IWKddddhNBpwWBOzFBZWNZGYIknusaEySiAqAmkOjxF9fRQEhBllm83DC_01yLFe_LkNDK-GhTidvsBP5cfdslOS4Xcep7MH9Qxcw
                                    [width] => 2048
                                )

                        )

                    [place_id] => ChIJhRSLDIGMGGARtWAwmj8-qws
                    [rating] => 3.8
                    [reference] => CmRRAAAABoB1cIiQlGLTrNdW8SpXmDRppF1j_EEyVT04xaGz4OoPj1yEJ2jY4Ia3F7WRDuWg-w77lCh-3e5Uh9E9ZrU3wO7xV6dhj2LqKrUZlj_VFWV6k0ed1mAufpkHSNtjWnMvEhAf4iPlBprieFQxr9_NFiMRGhRQaHzEiHpm-8WBZHS2BYYKMMlBsg
                    [types] => Array
                        (
                            [0] => embassy
                            [1] => point_of_interest
                            [2] => establishment
                        )

                )

            [10] => Array
                (
                    [formatted_address] => 1 Chome-7-32 Minamiazabu, 港区 Tokyo 106-0047, Japan
                    [geometry] => Array
                        (
                            [location] => Array
                                (
                                    [lat] => 35.6515545
                                    [lng] => 139.7370174
                                )

                            [viewport] => Array
                                (
                                    [northeast] => Array
                                        (
                                            [lat] => 35.6529034803
                                            [lng] => 139.73836638
                                        )

                                    [southwest] => Array
                                        (
                                            [lat] => 35.6502055197
                                            [lng] => 139.73566842
                                        )

                                )

                        )

                    [icon] => https://maps.gstatic.com/mapfiles/place_api/icons/civic_building-71.png
                    [id] => 9dea8aefa2850581f722f212dcbe23423c7efdd2
                    [name] => 駐日本国大韓民国大使館 領事部
                    [opening_hours] => Array
                        (
                            [open_now] => 
                            [weekday_text] => Array
                                (
                                )

                        )

                    [photos] => Array
                        (
                            [0] => Array
                                (
                                    [height] => 3264
                                    [html_attributions] => Array
                                        (
                                            [0] => <a href="https://maps.google.com/maps/contrib/111099345876033074654/photos">takashi numajiri</a>
                                        )

                                    [photo_reference] => CmRaAAAAMTNyM5jdDagPjK2ULQ20GX6gCyCXGcSBq7-CDxhwiBgTybXie9fXzf3iN4Yocb_70mZ5Z7FzKKJHxswSTxfVPamebGVK5D6whLjt294M19Yi7wkR-kXJ93OSfeDeAIxgEhA7gWZpPqvOGSiBvHACUtQPGhTjUD05ZRuJ-kmZY-_FVHOveUBJ5A
                                    [width] => 2448
                                )

                        )

                    [place_id] => ChIJDUG9VaGLGGAR4p8vgOMaTM0
                    [rating] => 3.9
                    [reference] => CmRSAAAA7uVItQf3TAqSp71umNPTjUlP7GAaK5hjZGr_gz_N-nyTEcF3dRCsN5kh0hEvlf5-Pw--M4m6VpPkK48IgSfckoyY81vF0pqZ5RFQRr_RjKJH2RYSP9nPCcpYLKjJobegEhDiSnNHvebIztOkO9d_ptbLGhTPTHeOJWlOqYXC34u5437yyln41Q
                    [types] => Array
                        (
                            [0] => embassy
                            [1] => point_of_interest
                            [2] => establishment
                        )

                )

            [11] => Array
                (
                    [formatted_address] => 5-4 Nibancho, Chiyoda, Tokyo 102-0084, Japan
                    [geometry] => Array
                        (
                            [location] => Array
                                (
                                    [lat] => 35.685095
                                    [lng] => 139.735866
                                )

                            [viewport] => Array
                                (
                                    [northeast] => Array
                                        (
                                            [lat] => 35.6864439803
                                            [lng] => 139.73721498
                                        )

                                    [southwest] => Array
                                        (
                                            [lat] => 35.6837460197
                                            [lng] => 139.73451702
                                        )

                                )

                        )

                    [icon] => https://maps.gstatic.com/mapfiles/place_api/icons/civic_building-71.png
                    [id] => b42a7424a15be01ed288ad93604dfd55b084cc07
                    [name] => ベルギー王国大使館
                    [opening_hours] => Array
                        (
                            [open_now] => 
                            [weekday_text] => Array
                                (
                                )

                        )

                    [photos] => Array
                        (
                            [0] => Array
                                (
                                    [height] => 432
                                    [html_attributions] => Array
                                        (
                                            [0] => <a href="https://maps.google.com/maps/contrib/114242709835120958007/photos">ベルギー王国大使館</a>
                                        )

                                    [photo_reference] => CmRaAAAA-c2U-tUcolK58qOeMuRMQ3Sv_nwIbDEsLLvpGlwK039R6F3A4vtTVsyhYnvxhhRKUzrNM-Jct764RV-OBiJuVymu0NUmu6ZIAfTd7IvHI3wT9usdv1olfRccDhllQBPwEhAfKSNbQOnKqOSf2fI9CbODGhReUlXbgbnoJ1f_bGNmgmCw4CzJ4w
                                    [width] => 640
                                )

                        )

                    [place_id] => ChIJ9Zm6dGOMGGARjc7BxGX55WU
                    [rating] => 3.9
                    [reference] => CmRRAAAAEindmo-FB7aR1cco1GnB66wFuCq-aaguicyYtdbGeLkBgIE_P2ldDXArT1u2tqwHsX_DVAdxa1iMHTWznH24N6CNVa4B99lu7FbkbPlANpX111euERizcjCOqcI_VW2gEhBgcuyUcaNoydJQ9vn5CA8KGhQ_GSasaB0icqhXtWH5VkjSsJuNbw
                    [types] => Array
                        (
                            [0] => embassy
                            [1] => point_of_interest
                            [2] => establishment
                        )

                )

            [12] => Array
                (
                    [formatted_address] => 2520 Massachusetts Ave NW, Washington, DC 20008, United States
                    [geometry] => Array
                        (
                            [location] => Array
                                (
                                    [lat] => 38.915611
                                    [lng] => -77.0562043
                                )

                            [viewport] => Array
                                (
                                    [northeast] => Array
                                        (
                                            [lat] => 38.9171183303
                                            [lng] => -77.0546636197
                                        )

                                    [southwest] => Array
                                        (
                                            [lat] => 38.9144203697
                                            [lng] => -77.0573615803
                                        )

                                )

                        )

                    [icon] => https://maps.gstatic.com/mapfiles/place_api/icons/civic_building-71.png
                    [id] => e798149a725041f0e9497770a6886d49490ef6f1
                    [name] => 日本国大使館
                    [opening_hours] => Array
                        (
                            [open_now] => 
                            [weekday_text] => Array
                                (
                                )

                        )

                    [photos] => Array
                        (
                            [0] => Array
                                (
                                    [height] => 2340
                                    [html_attributions] => Array
                                        (
                                            [0] => <a href="https://maps.google.com/maps/contrib/108407196489350025768/photos">Tomo kartofeli</a>
                                        )

                                    [photo_reference] => CmRaAAAAvk-VyPF24OahV_JctAkuw2f22ymIwZJXwdh7EUynE-gUBk1IvllhJ5dGGYPy3gVpzHe98Q8pu0CCAE-xtcAsshV_X8BuyyP-gWF6esqVspspWz9_gTOsBV1YO2QbPTCfEhBo-I8MXj_Mf9sqAhhBSGq4GhQcQVVSb2t2oCjFEXssAP05zEpoXg
                                    [width] => 4160
                                )

                        )

                    [place_id] => ChIJ3Q8VzMy3t4kRST6n7AYRh0Y
                    [rating] => 4
                    [reference] => CmRRAAAA3ThFc0SfgOTxb8xkHj1nmvq7DIYE1ZSqbsdKOFDm7dteqH7nTMgRfh6reC1eV6SPZS8jLOHUL0Xg5Mwd3gYFyCnQQG6exXYaaLimOoyxqAepFVBVGIzAMZ98hOb6R-QeEhDIP9rWK27KktujUuqhJD3KGhRuC-dXoJwT_evUyjmkoAb1h2WMkw
                    [types] => Array
                        (
                            [0] => embassy
                            [1] => point_of_interest
                            [2] => establishment
                        )

                )

            [13] => Array
                (
                    [formatted_address] => 23 Chome-5-1 Minami 13 Jonishi, Chuo Ward, Sapporo, Hokkaido Prefecture 064-0913, Japan
                    [geometry] => Array
                        (
                            [location] => Array
                                (
                                    [lat] => 43.039336
                                    [lng] => 141.324333
                                )

                            [viewport] => Array
                                (
                                    [northeast] => Array
                                        (
                                            [lat] => 43.0406849803
                                            [lng] => 141.32568198
                                        )

                                    [southwest] => Array
                                        (
                                            [lat] => 43.0379870197
                                            [lng] => 141.32298402
                                        )

                                )

                        )

                    [icon] => https://maps.gstatic.com/mapfiles/place_api/icons/civic_building-71.png
                    [id] => d64697913d2bc362961a149f09b0a79de12dd4fa
                    [name] => 中華人民共和国 駐札幌総領事館
                    [place_id] => ChIJIS8ILf8pC18Rtc7aA-5nQAY
                    [rating] => 3
                    [reference] => CmRRAAAAJz5JfdhsBSPyO5hlktubhQq8Nhn21ZumOnj_88HMQh8Pru3Alm1TbrfxacnFF2XFTzuvAOEGr55sgmDTo-orNJkXaN3bHZ_NSARxB9qN8E_5sLu2Dzq4BD3yeABKNj_yEhC7wbZiQWwENcxbN8HaIlCBGhSw8jdcRz3vAhqWhwg6LEcVFSXWMA
                    [types] => Array
                        (
                            [0] => embassy
                            [1] => point_of_interest
                            [2] => establishment
                        )

                )

            [14] => Array
                (
                    [formatted_address] => 45-24 Oyamacho, Shibuya, Tokyo 151-0065, Japan
                    [geometry] => Array
                        (
                            [location] => Array
                                (
                                    [lat] => 35.6692229
                                    [lng] => 139.6776361
                                )

                            [viewport] => Array
                                (
                                    [northeast] => Array
                                        (
                                            [lat] => 35.6705718803
                                            [lng] => 139.67898508
                                        )

                                    [southwest] => Array
                                        (
                                            [lat] => 35.6678739197
                                            [lng] => 139.67628712
                                        )

                                )

                        )

                    [icon] => https://maps.gstatic.com/mapfiles/place_api/icons/civic_building-71.png
                    [id] => 371629932ce9362f7cec3cfd088cf7abd68c17b5
                    [name] => Embassy of Burkina Faso in Japan 駐日ブルキナファソ大使館
                    [place_id] => ChIJt8gQmzjzGGARmWdF24Mn0ns
                    [rating] => 5
                    [reference] => CmRRAAAAAmU0Ui4L0qm8GY-Yf24RhGEV2K56V8LA5lXN4edKNIEo9oE6FxJJU-yI10ufB-ry8aLIRdAoVHcse02--VD9cIj4-3gYK_wRpHsIKodH5KmPaVDoErrRt_W1GeK1Zkh_EhCLQyVhvNUGnKWk-1r41nTcGhRrFB0J6pDIOxKNL7Xi9ciuHYhoog
                    [types] => Array
                        (
                            [0] => embassy
                            [1] => point_of_interest
                            [2] => establishment
                        )

                )

            [15] => Array
                (
                    [formatted_address] => 2 Chome-11-12 Kitaaoyama, 港区 Tokyo 107-0061, Japan
                    [geometry] => Array
                        (
                            [location] => Array
                                (
                                    [lat] => 35.670846
                                    [lng] => 139.7145132
                                )

                            [viewport] => Array
                                (
                                    [northeast] => Array
                                        (
                                            [lat] => 35.6721949803
                                            [lng] => 139.71586218
                                        )

                                    [southwest] => Array
                                        (
                                            [lat] => 35.6694970197
                                            [lng] => 139.71316422
                                        )

                                )

                        )

                    [icon] => https://maps.gstatic.com/mapfiles/place_api/icons/civic_building-71.png
                    [id] => d0fda1d0c45321ece76ba57652250e2697763be2
                    [name] => ブラジル連邦共和国大使館
                    [opening_hours] => Array
                        (
                            [open_now] => 
                            [weekday_text] => Array
                                (
                                )

                        )

                    [photos] => Array
                        (
                            [0] => Array
                                (
                                    [height] => 2160
                                    [html_attributions] => Array
                                        (
                                            [0] => <a href="https://maps.google.com/maps/contrib/113397042711160456262/photos">asahi Luoxu</a>
                                        )

                                    [photo_reference] => CmRaAAAAWaHT36DW85m3hsJNEYAJBBvevWZUWtt34K0EEIWWxs0YzGyxJ2xBhCDspD8VMJVRfltdF5nwU4jfN3zKEyDlcykVsknvdWpvlcL-cI1EaMpmWO54qCN2L1JGsbh3TLsuEhCpPln-Bw9zY87F7H-O7_gTGhSe7jYbVEkUFGrNrhFMtg8ON4VxwA
                                    [width] => 3840
                                )

                        )

                    [place_id] => ChIJ-4jHI5mMGGARI-dLuTQqmMI
                    [rating] => 4.3
                    [reference] => CmRSAAAAgPqSOADAvEWOKd99x2nokuuEcoS2hZohUWul3NIwjHRYr8AKU_PvQpULI4IFP4XhoEygQI7ONA9nEW-ZhdJ1y0CnuF8-IkLOpxhAnKOgIj4iDmbyHathNSBIFpIqUJKCEhB6Xp5ZRrTCZyFg5BQw4Da1GhShwTiCp1eXSbOxahfRoDvB-9L9Ow
                    [types] => Array
                        (
                            [0] => embassy
                            [1] => point_of_interest
                            [2] => establishment
                        )

                )

            [16] => Array
                (
                    [formatted_address] => 1 Chome-2-5 Minamiazabu, Minato, Tokyo 106-0047, Japan
                    [geometry] => Array
                        (
                            [location] => Array
                                (
                                    [lat] => 35.6521084
                                    [lng] => 139.7326429
                                )

                            [viewport] => Array
                                (
                                    [northeast] => Array
                                        (
                                            [lat] => 35.6534573803
                                            [lng] => 139.73399188
                                        )

                                    [southwest] => Array
                                        (
                                            [lat] => 35.6507594197
                                            [lng] => 139.73129392
                                        )

                                )

                        )

                    [icon] => https://maps.gstatic.com/mapfiles/place_api/icons/civic_building-71.png
                    [id] => a93a9adfd1d500c38c7c64383b23cb3292d06afe
                    [name] => 韓国大使館
                    [opening_hours] => Array
                        (
                            [open_now] => 
                            [weekday_text] => Array
                                (
                                )

                        )

                    [photos] => Array
                        (
                            [0] => Array
                                (
                                    [height] => 1280
                                    [html_attributions] => Array
                                        (
                                            [0] => <a href="https://maps.google.com/maps/contrib/110296644055579959689/photos">蝦夷 kyokuduki99</a>
                                        )

                                    [photo_reference] => CmRaAAAA8IMn6mCh-8NhieEMBw7hGCJa5JvX15rlB2csk4BzuBulcMp1bc5u2tLW124iQuG3A_r0BNnJI1GA7mQI-hjZ5phi4Y_Xrgm9F6xRrVtJFd6GedyAV9GdFTrta-BAkLeQEhBZthxvD81H2KNiDIvDUPEFGhTIqIjnAi7UZ5HALVD7W0Q4mYxoSQ
                                    [width] => 720
                                )

                        )

                    [place_id] => ChIJDUG9VaGLGGARYL8hdaIiVow
                    [rating] => 3.4
                    [reference] => CmRSAAAAHfPldM_6BcSMQDnJaah7sl4u0cfQpExSYH9gNL_fd3CSAEcVf8GZ1Yk7XPs8QzNHgUCSULIlHV43XcqP-rBaS6TO_ACEMkrsQHdbwA6mEbew0hUQo-WOkY7C2wcY--mTEhApFrRVQt0wikCRMkIQBk_RGhSt9dEsoU4i7IlryVjRrUXPo6mnhA
                    [types] => Array
                        (
                            [0] => embassy
                            [1] => point_of_interest
                            [2] => establishment
                        )

                )

            [17] => Array
                (
                    [formatted_address] => Japan
                    [geometry] => Array
                        (
                            [location] => Array
                                (
                                    [lat] => 43.056348
                                    [lng] => 141.313697
                                )

                            [viewport] => Array
                                (
                                    [northeast] => Array
                                        (
                                            [lat] => 43.0576969803
                                            [lng] => 141.31504598
                                        )

                                    [southwest] => Array
                                        (
                                            [lat] => 43.0549990197
                                            [lng] => 141.31234802
                                        )

                                )

                        )

                    [icon] => https://maps.gstatic.com/mapfiles/place_api/icons/civic_building-71.png
                    [id] => e9bd1fd756a68f5b6239d52b8d2fcfb2a78f0401
                    [name] => アメリカ合衆国駐札幌総領事館
                    [place_id] => ChIJqf3vS8IpC18RLyL41moupYg
                    [rating] => 3.8
                    [reference] => CmRSAAAAsud0DQoipzFe5SSWsXJImtq7tI1n1UTrzZ54cRR0FiveimQ4hYevD-Y1Xd0FV1e6mE2lttYGa1fytF4t_HzSTZ-2ISbthEqmWNQ8qjTnUUrKUF1gD5p_jVnQumbKzVNEEhATlys3SMBxLVG2zmy8TuTkGhRA5oLVW8wAtsuRf959hXjRd6ZjKg
                    [types] => Array
                        (
                            [0] => embassy
                            [1] => point_of_interest
                            [2] => establishment
                        )

                )

            [18] => Array
                (
                    [formatted_address] => Japan, 〒107-0052 Tokyo, Minato, Akasaka, 1 Chome−1−14, 野村不動産溜池ビル 8階
                    [geometry] => Array
                        (
                            [location] => Array
                                (
                                    [lat] => 35.670911
                                    [lng] => 139.744326
                                )

                            [viewport] => Array
                                (
                                    [northeast] => Array
                                        (
                                            [lat] => 35.6722599803
                                            [lng] => 139.74567498
                                        )

                                    [southwest] => Array
                                        (
                                            [lat] => 35.6695620197
                                            [lng] => 139.74297702
                                        )

                                )

                        )

                    [icon] => https://maps.gstatic.com/mapfiles/place_api/icons/civic_building-71.png
                    [id] => 7e41966846cd71d15e5f14152f1d6936625cf2cf
                    [name] => アメリカンセンターJAPAN
                    [opening_hours] => Array
                        (
                            [open_now] => 
                            [weekday_text] => Array
                                (
                                )

                        )

                    [photos] => Array
                        (
                            [0] => Array
                                (
                                    [height] => 517
                                    [html_attributions] => Array
                                        (
                                            [0] => <a href="https://maps.google.com/maps/contrib/102065650000814267766/photos">アメリカンセンターJAPAN</a>
                                        )

                                    [photo_reference] => CmRaAAAAcpfudyVeYY1IpWVusm6s-AdJWI7oAINgq0ILs2jf_1mwl8irpjUlCi4oRRaqjlsQmdopIWkCMu8CGhFx3lenCXK0r9Zmhq8XSvQKcWhL2Avt0z4vF3XEp2ajQFf84y-6EhCtTxVn2vJLS1SOMo62FVAQGhS-BbXTFc5kOQp65o75RiUa2aswJw
                                    [width] => 780
                                )

                        )

                    [place_id] => ChIJ___PBI-LGGARhWlgARYbmJc
                    [rating] => 3
                    [reference] => CmRSAAAAltYzXjNCjSWiufiaAg8MdEmYIsqv7L02itnfYVeQnKK3ayQLYS_IkoTepUluFyIB-rI6D7pbN_x72uPfSMJ8kK7ODGRWflj6-zTULc_QOLUdO2LuRAp5LqG-KZDVDZy2EhA4-APd7lM2ZXFcFMrTA1RqGhSEBONv8ghedYW9AccOElZu0NY5rA
                    [types] => Array
                        (
                            [0] => embassy
                            [1] => point_of_interest
                            [2] => establishment
                        )

                )

            [19] => Array
                (
                    [formatted_address] => 2 Chome-8-37 Higashisakura, Higashi Ward, Nagoya, Aichi Prefecture 461-0005, Japan
                    [geometry] => Array
                        (
                            [location] => Array
                                (
                                    [lat] => 35.173062
                                    [lng] => 136.915956
                                )

                            [viewport] => Array
                                (
                                    [northeast] => Array
                                        (
                                            [lat] => 35.1744109803
                                            [lng] => 136.91730498
                                        )

                                    [southwest] => Array
                                        (
                                            [lat] => 35.1717130197
                                            [lng] => 136.91460702
                                        )

                                )

                        )

                    [icon] => https://maps.gstatic.com/mapfiles/place_api/icons/civic_building-71.png
                    [id] => 667e1d8e108ed2997ab1107d3489f0baf9d7b1b5
                    [name] => 駐名古屋中華人民共和国総領事館
                    [photos] => Array
                        (
                            [0] => Array
                                (
                                    [height] => 4032
                                    [html_attributions] => Array
                                        (
                                            [0] => <a href="https://maps.google.com/maps/contrib/100342168036503190102/photos">Xin Wang</a>
                                        )

                                    [photo_reference] => CmRaAAAABMqt4CwMfaLZdkDa-rr2sJXWNIdzbKsZIcE_mq031GuXccvTqr8U5UuOSylVmSPEv821Xq2DIDixXswYBcNjqaOJcygpxOTh17q-Q5RhDwZ8Fg1LipAyF4ByYoDfZkY3EhC0Lrspsz1evyiakokKFBloGhS7i62FNLts_CDw89gDET-4QZEeEA
                                    [width] => 3024
                                )

                        )

                    [place_id] => ChIJ3-tD3NtwA2ARM3Il9FI1Z40
                    [rating] => 3.6
                    [reference] => CmRSAAAAL64ULDVfQ_JM23fqjiGzSTimAbruKtk7alf2uRG-Jpj_Q3kYjEGVE-pYPuqn5lgEENcBmkYT9-AQ1uqiwMyirwy19NjI1dZcel3rxrFW8LVodOLXpWqocZoswReL-I3vEhDOs0MyPNGjHgk_-DrQTDrxGhSf553TKkeG6O7gw-wLIpomKPUBdA
                    [types] => Array
                        (
                            [0] => embassy
                            [1] => point_of_interest
                            [2] => establishment
                        )

                )

        )

    [status] => OK
)

photo

この値は 画像を取得する際に必要です。
尚 画像の取得には 再度 別のAPIを叩く必要があります。

place_id

この値は 場所の詳細情報を取得する際に必要です。
尚 詳細情報の取得には 再度 別のAPIを叩く必要があります。
詳細情報には 複数のレビューやフォトなども含まれています。

参考文献

本サイトでは URLに日本語を含んでいます。
メールなどで共有する場合は リンクとして認識されない場合がございますので、こちらをご利用ください。