Geokit is a GeoJson/Turf/WFS model Collection for KMP
  • Kotlin 97%
  • ANTLR 3%
Find a file
2026-09-21 08:21:41 +02:00
.ai Add .ai/ documentation guides for multiple modules 2026-08-04 16:33:11 +02:00
.github/workflows debug: add --info to capture dependency resolution failure 2026-09-21 08:21:41 +02:00
.idea Remove outdated CRS implementation and integrate ANTLR-based WKT parsing. 2025-10-21 23:08:55 +02:00
calculation fix: use System.getenv() for credentials (Decompose pattern) 2026-09-21 08:16:45 +02:00
coordinates fix: use System.getenv() for credentials (Decompose pattern) 2026-09-21 08:16:45 +02:00
fwi fix: use System.getenv() for credentials (Decompose pattern) 2026-09-21 08:16:45 +02:00
geojson fix: use System.getenv() for credentials (Decompose pattern) 2026-09-21 08:16:45 +02:00
gradle fix(deps): update dependency cloud.mallne:units to v1.0.0 2026-09-19 19:36:15 +00:00
interop fix: use System.getenv() for credentials (Decompose pattern) 2026-09-21 08:16:45 +02:00
ogc fix: use System.getenv() for credentials (Decompose pattern) 2026-09-21 08:16:45 +02:00
.gitignore Remove CRS AST expression models no longer in use 2025-10-24 15:33:26 +02:00
AGENTS.md Add .ai/ documentation guides for multiple modules 2026-08-04 16:33:11 +02:00
build.gradle.kts fix: use System.getenv() for credentials (Decompose pattern) 2026-09-21 08:16:45 +02:00
gradle.properties fix: proper gradle wrapper, conditional signing, updated workflows 2026-09-19 10:10:53 +02:00
gradlew fix: proper gradle wrapper, conditional signing, updated workflows 2026-09-19 10:10:53 +02:00
gradlew.bat fix: proper gradle wrapper, conditional signing, updated workflows 2026-09-19 10:10:53 +02:00
LICENSE Initial commit 2025-09-18 13:55:17 +02:00
README.md Add Fire Weather Index calculation module and related utilities 2026-05-11 23:29:31 +02:00
renovate.json fix: use regex allowedVersions to filter cloud.mallne to stable only 2026-09-19 22:10:19 +02:00
settings.gradle.kts fix: remove composite build, resolve units from Nexus directly 2026-09-20 23:54:37 +02:00

🌍 Geokit

Kotlin License Kotlin Multiplatform

Geokit is a powerful, type-safe geospatial toolkit for Kotlin Multiplatform. It brings a "Turf-like" experience to the Kotlin ecosystem, providing comprehensive utilities for coordinate math, GeoJSON handling, GML/WFS parsing, and WKT-CRS transformations.


🚀 Key Features

  • 📐 Turf-like Math: Geometric calculations, distance measurements, and vector operations.
  • 🔥 Fire Weather Index: Hourly FWI calculations (FFMC, DMC, DC, ISI, BUI, FWI) with strict parity to NRCan/CFS reference implementation.
  • 🌐 Multi-module Design: Only use what you need (calculation, geojson, ogc, coordinates, fwi).
  • 🛠️ CRS Transformations: Parse WKT-CRS and perform coordinate conversions (e.g., EPSG:4326 to EPSG:25832).
  • 📦 GeoJSON & GML: First-class support for industry-standard formats via kotlinx.serialization.
  • 🏗️ Kotlin Multiplatform: Targets JVM, Android, JS, WasmJS, iOS, and Linux.

📦 Modules

1. calculation

Core vector-based coordinate math. Uses a type-safe units library for measurements.

val point1 = Vertex(50.96, 10.99)
val point2 = Vertex(51.00, 11.05)

// Type-safe distance and bearing
val dist: Measure<Length> = point1 distanceTo point2
val bearing: Measure<Angle> = point1 angleTo point2

// Point-in-polygon check
val isInside = vertex inside shape

2. coordinates

WKT-CRS parser and transformation pipeline. Supports complex coordinate operations.

val registry = CrsRegistry()
registry.ingest(BuiltInCoordinateReferenceSystems.EPSG4326)
registry.ingest(BuiltInCoordinateReferenceSystems.EPSG25832)

val pipeline = registry.compose(
    source = LocalCoordinate(50.963841, 10.998273),
    fromEPSG = "EPSG:4326",
    toEPSG = "EPSG:25832"
)

val result = pipeline.execute() // Northing/Easting

3. geojson

GeoJSON implementation based on kotlinx.serialization. Provides interop with MapLibre SpatialK.

val position = Position(longitude = 10.99, latitude = 50.96)
val vertex = position.toVertex() // Convert to Geokit Vertex for math

4. ogc

GML and WFS (Web Feature Service) implementation. Handles XML parsing and generation for OGC services.

5. interop

The "glue" module that maps between GeoJSON models and OGC/GML types.

6. fwi

Hourly Fire Weather Index (FWI) system. A strict Kotlin Multiplatform port of the NRCan/CFS Python reference (NG_FWI.py).

val weatherStream = listOf(
    WeatherRow.Input(
        id = "STATION1",
        date = LocalDate(2023, 7, 1),
        hr = 12,
        temp = 25.5,
        rh = 40.0,
        ws = 15.0,
        prec = 0.0,
        lat = 45.0,
        long = -75.0,
        timezone = -5.0
    )
)

val processed = FireWeatherIndex(weatherStream)
val result = processed.first()

println("FWI: ${result.fwi}")
println("FFMC: ${result.ffmc}")

🛠 Installation

Add the following to your build.gradle.kts:

repositories {
    mavenCentral()
    // Add your registry if needed
}

dependencies {
    implementation("cloud.mallne.geokit:calculation:1.0.0-SNAPSHOT")
    implementation("cloud.mallne.geokit:geojson:1.0.0-SNAPSHOT")
    implementation("cloud.mallne.geokit:fwi:1.0.0-SNAPSHOT")
    // ... other modules
}

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request or open an issue.

📄 License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.