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)
}