Skip to content

Latest commit

 

History

History
51 lines (38 loc) · 1.09 KB

README.md

File metadata and controls

51 lines (38 loc) · 1.09 KB

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