Skip to content

jawg/geojson-jackson-jts-extensions

Repository files navigation

JTS extensions for GeoJSON

Kotlin extensions to convert GeoJSON to JTS and vice-versa.

Requirements

  • Java 8+

Dependency

Add the dependency in your dependencies { ... }:

implementation("io.jawg.geojson:geojson-jackson-jts-extensions:1.0.2")

For SNAPSHOT versions add the repository in your repositories { ... }:

maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") }

Usage

Convert a GeoJSON Geometry to a JTS Geometry:

val geoJsonGeometry: Geometry = ...
val jtsGeometry = geoJsonGeometry.toJts()

// or on Features
val feature: Feature = ...
val jtsGeometry = feature.toJts() // feature id and properties will be stored in userData

Convert a JTS Geometry to a GeoJSON Geometry:

val jtsGeometry = ...
val geoJsonGeometry = jtsGeometry.toGeoJson()

// or to Feature
val jtsGeometry = ...
val feature = jtsGeometry.toFeature() // feature id and properties will be retrieved from userData

Build the library

./gradlew build

Publish the library

./gradlew publish

About

Kotlin extensions to convert GeoJSON to JTS and vice-versa

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages