Skip to content

Releases: dellisd/spatial-k

0.3.0

19 Feb 21:58
Compare
Choose a tag to compare

What's Changed

Full Changelog: 0.2.1...0.3.0

0.2.1

16 Apr 22:51
Compare
Choose a tag to compare

Changes

  • Make fromJson(JsonObject) functions consistently public (some were marked internal).
  • Fixed issues with tabs on project site
  • Use Dokka HTML documentation format

0.2.0

16 Apr 04:01
Compare
Choose a tag to compare

Breaking Changes

  • New serialization APIs
    toFeature and toGeometryOrNull functions replaced with fromJson and fromJsonOrNull functions.
// Old (0.1.1):
val feature: Feature = "{...}".toFeature()
println(feature.json)

val point = "{not a point}".toGeometryOrNull<Point>()

// New (0.2.0):
val feature: Feature = Feature.fromJson("{...}")
println(feature.json())

val point = Point.fromJsonOrNull("{not a point}")
  • Geometry DSLs simplified to reduce how often the unary plus operator is used
// Old (0.1.1):
multiLineString {
  +lineString {
    +lngLat(45.0, 45.0)
    +lngLat(0.0, 0.0)
    +lngLat(74.0, -43.2)
  }
  +someOtherLineString
}

// New (0.2.0):
multiLineString {
  lineString {
    point(45.0, 45.0)
    point(0.0, 0.0)
    +lngLat(74.0, -43.2) // unary plus can still be used, but no longer required
  }
  +someOtherLineString
}
  • Feature DSL simplified
// Old (0.1.1)
feature {
  geometry = point(0.0, 0.0)
  id = "sample"
  properties {
    "name" to "Sample"
    "size" to 6.2
  }
}

// New (0.2.0)
feature(geometry = point(0.0, 0.0), id = "sample") { // this: PropertiesBuilder
  put("name", "Sample")
  put("size", 6.2)
}

Performance Improvements

Serialization performance has been significantly improved. A new "fast" serialization method is now available when encoding GeoJSON objects directly to a JSON string through the GeoJson.json() function. Serializing through kotlinx.serialization as normal is also now much faster.

This table outlines the improvements based on benchmarks taken before and after the serialization changes when serializing a FeatureCollection with 15,000 features:

Encoding (ms/op, lower is better)

Target Old (0.1.0) New (kotlinx, 0.2.0) New (fast, 0.2.0)
JVM 834.176 250.776 71.450
JS 3287.40 986.504 178.458
Native (linuxX64) 5624.209 1073.703 326.828

Decoding (ms/op, lower is better)

Target Old (0.1.0) New (0.2.0)
JVM 77.700 88.444
JS 423.472 383.339
Native (linuxX64) 993.008 652.600

See BENCHMARK for more details.

New Turf Ports

0.1.1

03 Jun 04:36
Compare
Choose a tag to compare

Fixes a publishing issue.

0.1.0

03 Jun 04:09
Compare
Choose a tag to compare

Initial (non-snapshot) release of Spatial K.
Full documentation available on the project site.

GeoJson

Includes an implementation of GeoJson in Kotlin, with serialization support via kotlinx.serialization, along with a Kotlin DSL for constructing geometry, features, and feature collections.

With only a couple of exceptions, the API for the GeoJson implementation is considered stable.

Turf

A set of Turf functions ported for Kotlin Multiplatform are available in an experimental state.

The following functions are available in this release:

  • along
  • area
  • bbox
  • bboxPolygon
  • bearing
  • destination
  • distance
  • length
  • midpoint
  • lineIntersect (Partially implemented)
  • lineSlice
  • nearestPointOnLine
  • bearingToAzimuth
  • convertArea
  • convertLength
  • lengthToRadians
  • lengthToDegrees
  • radiansToLength

Turf helper functions (for constructing geometry/features) are available as the GeoJson DSL.

For full documentation on the available functions, see the project site.