LoginSignup
0
0

More than 3 years have passed since last update.

[Android]GoogleMap上ランドマークのストリートビュー表示

Posted at

GoogleMap上ランドマークのストリートビュー表示

以下の手順となります。
・ランドマークからPlaceIDを使ってplace/details API 実行して情報取得
・imageViewに表示するためライブラリ導入
・ストリートビュー表示する

ランドマークからPlaceIDを使ってplace/details API 実行して情報取得

imageViewに表示するためライブラリ導入

implementation "com.github.bumptech.glide:glide:4.8.0"

ストリートビュー表示する

buildingInfo.firstOrNull()?.let {
                var location = it.result!!.geometry!!.location
                var locationlatlng = location!!.lat.toString()+"," + location!!.lng.toString()

                val imageUri = Uri.Builder().apply {
                    scheme("https")
                    path("maps.googleapis.com/maps/api/streetview")
                    appendQueryParameter("size", "400x300")
                    appendQueryParameter("location", locationlatlng)
                    appendQueryParameter("key", BuildConfig.GOOGLE_API_KEY)
                }

                var imageview = findViewById<ImageView>(R.id.street_view_image)
                Glide.with(this).load(imageUri.toString()).into(imageview)

            }
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