
Converts Uber's H3 geospatial indexes to LatLng vertices and back, with utilities for geo→H3 conversion, polygon vertex extraction, and sample app examples.
A library to convert Uber's H3 geo-index to LatLng vertices and back for Kotlin Multiplatform: iOS and Android
kotlin {
sourceSets {
commonMain.dependencies {
implementation("io.github.phansier.h3:library:0.0.2")
/*
# or using version catalog:
# libs.version.toml
[versions]
h3 = "0.0.2"
[libraries]
h3 = { module = "io.github.phansier.h3:library", version.ref = "h3" }
*/
// implementation(libs.h3)
}
}
}dependencies {
implementation("io.github.phansier.h3:library:0.0.2")
// implementation(libs.h3)
}import com.beriukhov.h3.H3
import com.beriukhov.h3.LatLng as H3LatLng
// https://h3geo.org/#hex=084754a9ffffffff
val polygon: List<H3LatLng> = H3.vertices("084754a9ffffffff")
// res - Resolution, 0 <= res <= 15
val h3Index: String = geoToH3(H3LatLng(0.0, 0.0), res = 4).toHexString()open project in Android Studio and run the sample app
open 'sample/iosApp/iosApp.xcodeproj' in Xcode and run the sample app
./gradlew :library:publishToMavenLocal
~/.m2/repository/io/github/phansier/h3/
A library to convert Uber's H3 geo-index to LatLng vertices and back for Kotlin Multiplatform: iOS and Android
kotlin {
sourceSets {
commonMain.dependencies {
implementation("io.github.phansier.h3:library:0.0.2")
/*
# or using version catalog:
# libs.version.toml
[versions]
h3 = "0.0.2"
[libraries]
h3 = { module = "io.github.phansier.h3:library", version.ref = "h3" }
*/
// implementation(libs.h3)
}
}
}dependencies {
implementation("io.github.phansier.h3:library:0.0.2")
// implementation(libs.h3)
}import com.beriukhov.h3.H3
import com.beriukhov.h3.LatLng as H3LatLng
// https://h3geo.org/#hex=084754a9ffffffff
val polygon: List<H3LatLng> = H3.vertices("084754a9ffffffff")
// res - Resolution, 0 <= res <= 15
val h3Index: String = geoToH3(H3LatLng(0.0, 0.0), res = 4).toHexString()open project in Android Studio and run the sample app
open 'sample/iosApp/iosApp.xcodeproj' in Xcode and run the sample app
./gradlew :library:publishToMavenLocal
~/.m2/repository/io/github/phansier/h3/