0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

MIT App Inventorでルート検索を行う方法(Google Map Directions API)

Posted at

MIT App InventorでGoogle Map Directions APIを使用する

ここでは,MIT App InventorでGoogleMap Directions APIを使用する方法についてメモする.
うまく使えばナビを作れるのでは?

GoogleMap Directions API ドキュメント

押しポイント!

・移動手段(車,徒歩,自転車)を指定できる.
・通貨地点を指定できる.
・最適なルートを提案してくれる.

デザイナー画面

スクリーンショット 2025-02-21 010922.png

機能 内容
TextBox_出発 出発地点の入力
TextBox_目的 目的地点の入力
Button1 実行
Button2 リセット
Label_距離 距離の表示
Label_移動時間 移動時間の表示
Label_移動経路 ラベル
ListView1 移動経路の表示
Web1 Directions APIへのアクセス

ブロック

変数

沢山あるので重要なのだけ
blocks (1).png
blocks.png

https://maps.googleapis.com/maps/api/directions/json

Button1

blocks (2).png

ボタンクリックにより,Directions APIへアクセスを行う.

web1 got. Text

blocks (3).png

レスポンスから距離,時間,経路を抽出する.

Button2

blocks (4).png
Labelをきれいにする

実行画面

Screenshot_20250221-011149.png

おわりに

googleMapを表示するのもいいが,移動時間や距離のみを取得したいときに便利だろう...

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?