Skip to content

ShashlikMap/KoordXtract

Repository files navigation

KoordXtract

A small KMP utility library that helps to resolve shared links from map apps(with focus on GoogleMaps and Apple Maps) to latitude/longitude coordinates without relying on any Google API(e.g. Places) or any other APIs.

Initial goals of the library is to use it in shashlik-map project.

!! Google has changes something so that "place" sharing doesn't work now, but the "direction" sharing still provides a correct location!

Android demo application can receive a shared the link from GoogleMaps or it can launch an internal test that resolves some random links:

D  link: https://maps.app.goo.gl/wPn6i3inrCDNFD7r8, result: Either.Right((108.0465532, 12.7109931))
D  link: https://maps.app.goo.gl/SrjpRwuVfhqyKc5HA, result: Either.Right((139.6412587, 35.831881))
D  link: https://maps.app.goo.gl/HSUQp6K9L8z5efAY7, result: Either.Right((139.6641148, 35.791951600000004))
D  link: https://maps.app.goo.gl/nWx4HL35gqPhHrif8, result: Either.Right((-118.13840819999999, 33.8114365))
D  link: https://maps.app.goo.gl/tkQ8rmvUKTxnstZM8, result: Either.Right((72.8920559, 19.0483874))
D  link: https://maps.app.goo.gl/VWAUD4NbM45PDze36, result: Either.Right((-106.668247, 35.097595))
D  link: https://maps.app.goo.gl/7C7nDGQ15kKD3vCv5, result: Either.Right((-3.6945569, 40.4079123))
D  link: https://maps.app.goo.gl/r6AfdfewurGHRiLe7, result: Either.Right((42.2736908, 18.2124262))

How to use

  1. Add dependency to the version catalog
[versions]
koordxtract = "x.y.z" // the latest version

[libraries]
koordxtract = { group = "io.github.shashlikmap", name = "koordxtract", version.ref = "koordxtract" }

implementation(libs.koordxtract)
  1. KMP usage example
val xTractor = LatLonExtractor()
lifecycleScope.launch {
    val result = xTractor.extractFromStringData("https://maps.app.goo.gl/SrjpRwuVfhqyKc5HA")
    // use result
}

Or use a convienient extension for Intent in case of pure Android

xTractor.extractFromIntent(...)

Roadmap

  • More unit tests

About

KMP library to extract latitude/longitude from GoogleMaps and Apple Maps links

Topics

Resources

License

Stars

Watchers

Forks

Contributors