Power Appsにて地図アプリを作ることになったので、Tipsをメモ。
Google Maps APIのキーを取得
まずはAPIキーの取得から。



※大丈夫だと思うけど請求が発生しても責任はとれないので、自己責任でお願いします。

※厳重に管理してください。

カスタムコネクタの作成





https://maps.googleapis.com/maps/api/place/textsearch/json?query=XXX
を入力し、インポート。





// ※結果が多すぎるときは「next_page_token」が返ることもあるが、今回は考慮しない
{
"html_attributions": [],
"results": [
{
"formatted_address": "Tokyo, Japan",
"geometry": {
"location": {
"lat": 35.6764225,
"lng": 139.650027
},
"viewport": {
"northeast": {
"lat": 36.4408483,
"lng": 141.2405144
},
"southwest": {
"lat": 34.5776326,
"lng": 138.2991098
}
}
},
"icon": "XXX",
"icon_background_color": "#7B9EB0",
"icon_mask_base_uri": "XXX",
"name": "Tokyo",
"photos": [
{
"height": 3024,
"html_attributions": [
"XXX"
],
"photo_reference": "XXX",
"width": 3024
}
],
"place_id": "XXX",
"reference": "XXX",
"types": [
"administrative_area_level_1",
"political"
]
}
],
"status": "OK"
}
これでコネクタの作成は完了。



Power Apps作成






おまけ:地図コントロールへの表示
ForAll(result.results,
{
name:ThisRecord.name,
lat:ThisRecord.geometry.location.lat,
lng:ThisRecord.geometry.location.lng,
address:ThisRecord.formatted_address
}
)


