2
0
Fork 0
mirror of https://github.com/Mallne/GeoKit.git synced 2026-11-22 20:42:53 +01:00
Geokit is a GeoJson/Turf/WFS model Collection for KMP
  • Kotlin 96.2%
  • ANTLR 2.8%
  • JavaScript 1%
Find a file
Gamaliel Krauße 51d3f854fe
Merge pull request #60 from Mallne/renovate/dependency.analysis.v
chore(deps): update dependency com.autonomousapps.dependency-analysis to v3.20.4
2026-11-18 09:16:48 +01:00
.ai Add .ai/ documentation guides for multiple modules 2026-08-04 16:33:11 +02:00
.forgejo/workflows Add Actions workflows for PR checks, releases, and snapshots across multiple projects 2026-10-22 16:07:08 +02:00
.github/workflows Disable push trigger for "Publish SNAPSHOT" workflows across multiple modules. 2026-10-22 17:36:36 +02:00
.idea Remove outdated CRS implementation and integrate ANTLR-based WKT parsing. 2025-10-21 23:08:55 +02:00
calculation Refactor Vector.equals for readability and add VectorTest for equality logic validation 2026-11-04 17:14:53 +01:00
coordinates Add real-world UTM zone regression tests for EPSG:25832 and EPSG:25833 2026-11-09 16:05:39 +01:00
fwi refactor: streamline Maven publishing and credential usage 2026-09-21 13:53:52 +02:00
geojson refactor: streamline Maven publishing and credential usage 2026-09-21 13:53:52 +02:00
gradle chore(deps): update dependency com.autonomousapps.dependency-analysis to v3.20.4 2026-11-18 06:58:57 +00:00
interop Refactor WfsExtensions to improve WfsBoundedBy.toGeoJson calculations 2026-10-26 14:05:30 +01:00
ogc Make Filter in Query nullable for better flexibility in WFS query model 2026-10-26 14:36:51 +01: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 refactor: streamline Maven publishing and credential usage 2026-09-21 13:53:52 +02:00
gradle.properties chore: bump version to 1.1.1-SNAPSHOT [skip ci] 2026-11-06 08:46:50 +00: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 chore(ci): remove drone and teamcity from renovate auto-merge list 2026-11-17 12:26:13 +01:00
settings.gradle.kts build: add units build inclusion for monorepo context detection 2026-09-21 19:10:13 +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.