/geojson-kotlin

Multiplatform geojson serialization for kotlin

Primary LanguageKotlin

GeoJson Kotlin

Download Build Status GitHub License

This project goal is to provide GeoJson serialization for kotlin multiplatform (JVM, JS).

https://tools.ietf.org/html/rfc7946

The specific format of GeoJson files does not allow the use of kotlinx.serialization. JS and JVM implementations are completely distinct but they share the same base objects and interfaces.

JVM implementation is based on the project GeoJson-Jackson.

The project is deployed on maven central so you have to define it in your repositories.

repositories {
    mavenCentral()
}

To use it in a JS context add the following dependency:

    compile 'io.data2viz.geojson:geojson-js:0.6.0'

To use it in a JVM context add the following dependency:

    compile 'io.data2viz.geojson:geojson-jvm:0.6.0'

You can then use the String extension toGeoJsonObject to transform any String into a GeoJsonObject:

val featureCollection = json.toGeoJsonObject() as FeatureCollection