Android Google Maps LatLng to Bounds by Radius

Jul 22, 2018
import fun LatLng.toBounds(radius: Double): LatLngBounds {    // radius is in meter    val southwest = SphericalUtil.computeOffset(this, radius * Math.sqrt(2.0), 225.0)    val northeast = SphericalUtil.computeOffset(this, radius * Math.sqrt(2.0), 45.0)    return LatLngBounds(southwest, northeast)}

NOTE: Google Maps Android API Utility Library is used.

build.gradle (Module)

dependencies {
    implementation ''

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.