Geokit is a GeoJson/Turf/WFS model Collection for KMP
  • Kotlin 97%
  • ANTLR 3%
Find a file
Mallne 2fc00b68b4 Upgrade dependencies and refine Gradle scripts
Updated several dependencies including Kotlin, Ktor, and Maven Publish to newer versions. Improved Gradle scripts by replacing `properties` with `project.findProperty` for enhanced property resolution. Adjusted Gradle wrapper configurations and fixed syntax for better consistency in source set declarations.
2026-07-13 20:23:36 +02:00
.github Create dependabot.yml 2025-10-21 23:18:13 +02:00
.idea Remove outdated CRS implementation and integrate ANTLR-based WKT parsing. 2025-10-21 23:08:55 +02:00
calculation Upgrade dependencies and refine Gradle scripts 2026-07-02 15:06:47 +02:00
coordinates Upgrade dependencies and refine Gradle scripts 2026-07-02 15:06:47 +02:00
fwi Upgrade dependencies and refine Gradle scripts 2026-07-02 15:06:47 +02:00
geojson Upgrade dependencies and refine Gradle scripts 2026-07-02 15:06:47 +02:00
gradle Upgrade dependencies and refine Gradle scripts 2026-07-13 20:23:36 +02:00
interop Refactor FeatureMember and WfsExtensions to use XML.recommended_1_0 and simplify element handling 2026-07-06 13:46:34 +02:00
ogc Refactor FeatureMember and WfsExtensions to use XML.recommended_1_0 and simplify element handling 2026-07-06 13:46:34 +02:00
.gitignore Remove CRS AST expression models no longer in use 2025-10-24 15:33:26 +02:00
AGENTS.md Add Readme and Agents Files 2026-03-19 21:40:10 +01:00
build.gradle.kts Align Dependencies and better support for JS Target 2026-03-17 23:17:48 +01:00
gradle.properties remove deprecated Property 2026-03-12 16:16:31 +01: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
settings.gradle.kts Add Fire Weather Index calculation module and related utilities 2026-05-11 23:29:31 +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.