diff --git a/geojson/src/commonMain/kotlin/io/github/dellisd/spatialk/geojson/Feature.kt b/geojson/src/commonMain/kotlin/io/github/dellisd/spatialk/geojson/Feature.kt index ea22bdfb..cb7977ab 100644 --- a/geojson/src/commonMain/kotlin/io/github/dellisd/spatialk/geojson/Feature.kt +++ b/geojson/src/commonMain/kotlin/io/github/dellisd/spatialk/geojson/Feature.kt @@ -32,8 +32,8 @@ import kotlin.jvm.JvmStatic */ @Suppress("TooManyFunctions") @Serializable(with = FeatureSerializer::class) -class Feature( - val geometry: Geometry?, +class Feature( + val geometry: T?, properties: Map = emptyMap(), val id: String? = null, override val bbox: BoundingBox? = null @@ -80,7 +80,7 @@ class Feature( if (this === other) return true if (other == null || this::class != other::class) return false - other as Feature + other as Feature<*> if (geometry != other.geometry) return false if (id != other.id) return false @@ -115,26 +115,27 @@ class Feature( ) }}""" - fun copy( - geometry: Geometry? = this.geometry, + fun copy( + geometry: T? = this.geometry as T, properties: Map = this.properties, id: String? = this.id, bbox: BoundingBox? = this.bbox - ): Feature = Feature(geometry, properties, id, bbox) + ): Feature = Feature(geometry, properties, id, bbox) companion object { @JvmStatic - fun fromJson(json: String): Feature = fromJson(Json.decodeFromString(JsonObject.serializer(), json)) + fun fromJson(json: String): Feature = + fromJson(Json.decodeFromString(JsonObject.serializer(), json)) @JvmStatic - public fun fromJsonOrNull(json: String): Feature? = try { + public fun fromJsonOrNull(json: String): Feature? = try { fromJson(json) } catch (_: Exception) { null } @JvmStatic - public fun fromJson(json: JsonObject): Feature { + public fun fromJson(json: JsonObject): Feature { require(json.getValue("type").jsonPrimitive.content == "Feature") { "Object \"type\" is not \"Feature\"." } @@ -143,7 +144,7 @@ class Feature( val id = json["id"]?.jsonPrimitive?.content val geom = json["geometry"]?.jsonObject - val geometry: Geometry? = if (geom != null) Geometry.fromJson(geom) else null + val geometry: T? = if (geom != null) Geometry.fromJson(geom) as? T else null return Feature(geometry, json["properties"]?.jsonObject ?: emptyMap(), id, bbox) } diff --git a/geojson/src/commonMain/kotlin/io/github/dellisd/spatialk/geojson/FeatureCollection.kt b/geojson/src/commonMain/kotlin/io/github/dellisd/spatialk/geojson/FeatureCollection.kt index 6fb43fa3..f197b512 100644 --- a/geojson/src/commonMain/kotlin/io/github/dellisd/spatialk/geojson/FeatureCollection.kt +++ b/geojson/src/commonMain/kotlin/io/github/dellisd/spatialk/geojson/FeatureCollection.kt @@ -23,11 +23,14 @@ import kotlin.jvm.JvmStatic */ @Serializable(with = FeatureCollectionSerializer::class) class FeatureCollection( - val features: List = emptyList(), + val features: List> = emptyList(), override val bbox: BoundingBox? = null -) : Collection by features, GeoJson { +) : Collection> by features, GeoJson { - constructor(vararg features: Feature, bbox: BoundingBox? = null) : this(features.toMutableList(), bbox) + constructor(vararg features: Feature, bbox: BoundingBox? = null) : this( + features.toMutableList(), + bbox + ) override fun equals(other: Any?): Boolean { if (this === other) return true @@ -52,7 +55,7 @@ class FeatureCollection( override fun json(): String = """{"type":"FeatureCollection",${bbox.jsonProp()}"features":${features.jsonJoin { it.json() }}}""" - operator fun component1(): List = features + operator fun component1(): List> = features operator fun component2(): BoundingBox? = bbox companion object { @@ -74,7 +77,7 @@ class FeatureCollection( } val bbox = json["bbox"]?.jsonArray?.toBbox() - val features = json.getValue("features").jsonArray.map { Feature.fromJson(it.jsonObject) } + val features = json.getValue("features").jsonArray.map { Feature.fromJson(it.jsonObject) } return FeatureCollection(features, bbox) } diff --git a/geojson/src/commonMain/kotlin/io/github/dellisd/spatialk/geojson/dsl/FeatureCollectionDsl.kt b/geojson/src/commonMain/kotlin/io/github/dellisd/spatialk/geojson/dsl/FeatureCollectionDsl.kt index 970f0e65..3e286ed2 100644 --- a/geojson/src/commonMain/kotlin/io/github/dellisd/spatialk/geojson/dsl/FeatureCollectionDsl.kt +++ b/geojson/src/commonMain/kotlin/io/github/dellisd/spatialk/geojson/dsl/FeatureCollectionDsl.kt @@ -10,10 +10,10 @@ import kotlin.jvm.JvmName @GeoJsonDsl class FeatureCollectionDsl( - private val features: MutableList = mutableListOf(), + private val features: MutableList> = mutableListOf(), var bbox: BoundingBox? = null ) { - operator fun Feature.unaryPlus() { + operator fun Feature.unaryPlus() { features.add(this) } diff --git a/geojson/src/commonMain/kotlin/io/github/dellisd/spatialk/geojson/serialization/FeatureCollectionSerializer.kt b/geojson/src/commonMain/kotlin/io/github/dellisd/spatialk/geojson/serialization/FeatureCollectionSerializer.kt index ed7bb5d9..20508313 100644 --- a/geojson/src/commonMain/kotlin/io/github/dellisd/spatialk/geojson/serialization/FeatureCollectionSerializer.kt +++ b/geojson/src/commonMain/kotlin/io/github/dellisd/spatialk/geojson/serialization/FeatureCollectionSerializer.kt @@ -2,7 +2,6 @@ package io.github.dellisd.spatialk.geojson.serialization import io.github.dellisd.spatialk.geojson.FeatureCollection import io.github.dellisd.spatialk.geojson.serialization.BoundingBoxSerializer.toJsonArray -import io.github.dellisd.spatialk.geojson.serialization.FeatureSerializer.toJsonObject import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.descriptors.buildClassSerialDescriptor import kotlinx.serialization.json.JsonDecoder @@ -16,7 +15,7 @@ object FeatureCollectionSerializer : JsonSerializer { override val descriptor: SerialDescriptor = buildClassSerialDescriptor("FeatureCollection") override fun deserialize(input: JsonDecoder): FeatureCollection { - return FeatureCollection.Companion.fromJson(input.decodeJsonElement().jsonObject) + return FeatureCollection.fromJson(input.decodeJsonElement().jsonObject) } override fun serialize(output: JsonEncoder, value: FeatureCollection) { @@ -26,7 +25,7 @@ object FeatureCollectionSerializer : JsonSerializer { put( "features", buildJsonArray { - value.features.forEach { add(it.toJsonObject()) } + value.features.forEach { feature -> add(feature.toJsonObject()) } } ) } diff --git a/geojson/src/commonMain/kotlin/io/github/dellisd/spatialk/geojson/serialization/FeatureSerializer.kt b/geojson/src/commonMain/kotlin/io/github/dellisd/spatialk/geojson/serialization/FeatureSerializer.kt index 8c3a5ba1..d6cb0ce9 100644 --- a/geojson/src/commonMain/kotlin/io/github/dellisd/spatialk/geojson/serialization/FeatureSerializer.kt +++ b/geojson/src/commonMain/kotlin/io/github/dellisd/spatialk/geojson/serialization/FeatureSerializer.kt @@ -1,6 +1,7 @@ package io.github.dellisd.spatialk.geojson.serialization import io.github.dellisd.spatialk.geojson.Feature +import io.github.dellisd.spatialk.geojson.Geometry import io.github.dellisd.spatialk.geojson.serialization.BoundingBoxSerializer.toJsonArray import io.github.dellisd.spatialk.geojson.serialization.GeometrySerializer.toJsonObject import kotlinx.serialization.descriptors.SerialDescriptor @@ -12,21 +13,22 @@ import kotlinx.serialization.json.buildJsonObject import kotlinx.serialization.json.jsonObject import kotlinx.serialization.json.put -object FeatureSerializer : JsonSerializer { +internal class FeatureSerializer : JsonSerializer> { override val descriptor: SerialDescriptor = buildClassSerialDescriptor("Feature") - override fun deserialize(input: JsonDecoder): Feature = Feature.fromJson(input.decodeJsonElement().jsonObject) + override fun deserialize(input: JsonDecoder): Feature = Feature.fromJson(input.decodeJsonElement().jsonObject) - override fun serialize(output: JsonEncoder, value: Feature) { + override fun serialize(output: JsonEncoder, value: Feature) { output.encodeJsonElement(value.toJsonObject()) } - internal fun Feature.toJsonObject() = buildJsonObject { - put("type", "Feature") - bbox?.let { put("bbox", it.toJsonArray()) } - geometry?.let { put("geometry", it.toJsonObject()) } - id?.let { put("id", it) } +} - put("properties", JsonObject(properties)) - } +internal fun Feature.toJsonObject() = buildJsonObject { + put("type", "Feature") + bbox?.let { put("bbox", it.toJsonArray()) } + geometry?.let { put("geometry", it.toJsonObject()) } + id?.let { put("id", it) } + + put("properties", JsonObject(properties)) } diff --git a/geojson/src/commonMain/kotlin/io/github/dellisd/spatialk/geojson/serialization/Utils.kt b/geojson/src/commonMain/kotlin/io/github/dellisd/spatialk/geojson/serialization/Utils.kt index 51218f0f..0cde3bc0 100644 --- a/geojson/src/commonMain/kotlin/io/github/dellisd/spatialk/geojson/serialization/Utils.kt +++ b/geojson/src/commonMain/kotlin/io/github/dellisd/spatialk/geojson/serialization/Utils.kt @@ -4,9 +4,7 @@ import io.github.dellisd.spatialk.geojson.BoundingBox import io.github.dellisd.spatialk.geojson.Feature import io.github.dellisd.spatialk.geojson.Position import kotlinx.serialization.json.JsonArray -import kotlinx.serialization.json.buildJsonArray import kotlinx.serialization.json.double -import kotlinx.serialization.json.jsonArray import kotlinx.serialization.json.jsonPrimitive internal fun DoubleArray.jsonJoin(transform: ((Double) -> CharSequence)? = null) = @@ -17,7 +15,7 @@ internal fun Iterable.jsonJoin(transform: ((T) -> CharSequence)? = null) internal fun BoundingBox?.jsonProp(): String = if (this == null) "" else """"bbox":${this.json()},""" -internal fun Feature.idProp(): String = if (this.id == null) "" else """"id":"${this.id}",""" +internal fun Feature<*>.idProp(): String = if (this.id == null) "" else """"id":"${this.id}",""" internal fun JsonArray.toPosition(): Position = Position(this[0].jsonPrimitive.double, this[1].jsonPrimitive.double, this.getOrNull(2)?.jsonPrimitive?.double) diff --git a/geojson/src/commonTest/kotlin/io/github/dellisd/spatialk/geojson/serialization/FeatureCollectionSerializationTests.kt b/geojson/src/commonTest/kotlin/io/github/dellisd/spatialk/geojson/serialization/FeatureCollectionSerializationTests.kt index a2624ca4..4e47a6bb 100644 --- a/geojson/src/commonTest/kotlin/io/github/dellisd/spatialk/geojson/serialization/FeatureCollectionSerializationTests.kt +++ b/geojson/src/commonTest/kotlin/io/github/dellisd/spatialk/geojson/serialization/FeatureCollectionSerializationTests.kt @@ -2,6 +2,7 @@ package io.github.dellisd.spatialk.geojson.serialization import io.github.dellisd.spatialk.geojson.Feature import io.github.dellisd.spatialk.geojson.FeatureCollection +import io.github.dellisd.spatialk.geojson.LineString import io.github.dellisd.spatialk.geojson.Position import io.github.dellisd.spatialk.geojson.Point import kotlinx.serialization.encodeToString @@ -35,6 +36,30 @@ class FeatureCollectionSerializationTests { assertEquals(json, Json.encodeToString(collection), "FeatureCollection (kotlinx)") } + @Test + fun testSerializePolymorphicFeatureCollection() { + val position = Position(12.3, 45.6) + val point = Point(position) + val featurePoint = Feature( + point, mapOf( + "size" to JsonPrimitive(45.1), + "name" to JsonPrimitive("Nowhere") + ) + ) + val line = LineString(coordinates = listOf(position, Position(position.component2(), position.component1()))) + val featureLine = Feature(line) + val collection = FeatureCollection(featurePoint, featureLine) + val json = + """{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","coordinates": + |[12.3,45.6]},"properties":{"size":45.1,"name":"Nowhere"}},{"type":"Feature","geometry":{"type": + |"LineString","coordinates":[[12.3,45.6],[45.6,12.3]]},"properties":{}}]}""" + .trimMargin() + .replace("\n", "") + assertEquals(json, collection.json(), "FeatureCollection (fast)") + assertEquals(json, Json.encodeToString(collection), "FeatureCollection (kotlinx)") + } + + @Test fun testDeserializeFeatureCollection() { val geometry = Point(Position(12.3, 45.6)) @@ -57,4 +82,29 @@ class FeatureCollectionSerializationTests { ) ) } + + @Test + fun testDeerializePolymorphicFeatureCollection() { + val position = Position(12.3, 45.6) + val point = Point(position) + val featurePoint = Feature( + point, mapOf( + "size" to JsonPrimitive(45.1), + "name" to JsonPrimitive("Nowhere") + ) + ) + val line = LineString(coordinates = listOf(position, Position(position.component2(), position.component1()))) + val featureLine = Feature(line) + val collection = FeatureCollection(featurePoint, featureLine) + assertEquals( + collection, + FeatureCollection.fromJson( + """{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","coordinates": + |[12.3,45.6]},"properties":{"size":45.1,"name":"Nowhere"}},{"type":"Feature","geometry":{"type": + |"LineString","coordinates":[[12.3,45.6],[45.6,12.3]]},"properties":{}}]}""" + .trimMargin() + .replace("\n", "") + ) + ) + } } diff --git a/turf/src/commonMain/kotlin/io/github/dellisd/spatialk/turf/Booleans.kt b/turf/src/commonMain/kotlin/io/github/dellisd/spatialk/turf/Booleans.kt index fe1be0eb..4a06555f 100644 --- a/turf/src/commonMain/kotlin/io/github/dellisd/spatialk/turf/Booleans.kt +++ b/turf/src/commonMain/kotlin/io/github/dellisd/spatialk/turf/Booleans.kt @@ -20,6 +20,7 @@ import kotlin.jvm.JvmOverloads * the point is inside the polygon otherwise false. * @return `true` if the Position is inside the Polygon; `false` if the Position is not inside the Polygon */ +@ExperimentalTurfApi @JvmOverloads fun booleanPointInPolygon(point: Point, polygon: Polygon, ignoreBoundary: Boolean = false): Boolean { val bbox = bbox(polygon) @@ -38,6 +39,7 @@ fun booleanPointInPolygon(point: Point, polygon: Polygon, ignoreBoundary: Boolea * the point is inside the polygon otherwise false. * @return `true` if the Position is inside the Polygon; `false` if the Position is not inside the Polygon */ +@OptIn(ExperimentalTurfApi::class) @JvmOverloads fun booleanPointInPolygon(point: Point, polygon: MultiPolygon, ignoreBoundary: Boolean = false): Boolean { val bbox = bbox(polygon) diff --git a/turf/src/commonMain/kotlin/io/github/dellisd/spatialk/turf/Grids.kt b/turf/src/commonMain/kotlin/io/github/dellisd/spatialk/turf/Grids.kt index 328ecfea..1b008cf2 100644 --- a/turf/src/commonMain/kotlin/io/github/dellisd/spatialk/turf/Grids.kt +++ b/turf/src/commonMain/kotlin/io/github/dellisd/spatialk/turf/Grids.kt @@ -3,6 +3,7 @@ package io.github.dellisd.spatialk.turf import io.github.dellisd.spatialk.geojson.BoundingBox import io.github.dellisd.spatialk.geojson.Feature import io.github.dellisd.spatialk.geojson.FeatureCollection +import io.github.dellisd.spatialk.geojson.Geometry import io.github.dellisd.spatialk.geojson.Polygon import io.github.dellisd.spatialk.geojson.Position import kotlin.math.abs @@ -24,7 +25,7 @@ fun squareGrid( cellHeight: Double, units: Units = Units.Kilometers ): FeatureCollection { - val featureList = mutableListOf() + val featureList = mutableListOf>() val west = bbox.southwest.longitude val south = bbox.southwest.latitude val east = bbox.northeast.longitude @@ -33,8 +34,8 @@ fun squareGrid( val bboxWidth = east - west val cellWidthDeg = convertLength(cellWidth, units, Units.Degrees) - val bboxHeight = north - south; - val cellHeightDeg = convertLength(cellHeight, units, Units.Degrees); + val bboxHeight = north - south + val cellHeightDeg = convertLength(cellHeight, units, Units.Degrees) val columns = floor(abs(bboxWidth) / cellWidthDeg) val rows = floor(abs(bboxHeight) / cellHeightDeg) @@ -43,9 +44,9 @@ fun squareGrid( val deltaY = (bboxHeight - rows * cellHeightDeg) / 2 var currentX = west + deltaX - repeat (columns.toInt()) { + repeat(columns.toInt()) { var currentY = south + deltaY - repeat (rows.toInt()) { + repeat(rows.toInt()) { val positions = mutableListOf().apply { add(Position(currentX, currentY)) add(Position(currentX, currentY + cellHeightDeg)) @@ -58,9 +59,9 @@ fun squareGrid( }.also { featureList.add(Feature(Polygon(it))) } - currentY += cellHeightDeg; + currentY += cellHeightDeg } - currentX += cellWidthDeg; + currentX += cellWidthDeg } return FeatureCollection(featureList) } diff --git a/turf/src/commonMain/kotlin/io/github/dellisd/spatialk/turf/Measurement.kt b/turf/src/commonMain/kotlin/io/github/dellisd/spatialk/turf/Measurement.kt index 817099a9..4b3ba9b1 100644 --- a/turf/src/commonMain/kotlin/io/github/dellisd/spatialk/turf/Measurement.kt +++ b/turf/src/commonMain/kotlin/io/github/dellisd/spatialk/turf/Measurement.kt @@ -44,6 +44,7 @@ fun along(line: LineString, distance: Double, units: Units = Units.Kilometers): when { distance >= travelled && i == line.coordinates.size - 1 -> { } + travelled >= distance -> { val overshot = distance - travelled return if (overshot == 0.0) coordinate @@ -60,6 +61,7 @@ fun along(line: LineString, distance: Double, units: Units = Units.Kilometers): ) } } + else -> travelled += distance( coordinate, line.coordinates[i + 1], @@ -85,6 +87,7 @@ fun area(geometry: Geometry): Double { geom ) } + else -> calculateArea(geometry) } } @@ -97,6 +100,7 @@ private fun calculateArea(geometry: Geometry): Double { coords ) } + else -> 0.0 } } @@ -140,11 +144,13 @@ private fun ringArea(coordinates: List): Double { middleIndex = coordinates.size - 1 upperIndex = 0 } + coordinates.size - 1 -> { lowerIndex = coordinates.size - 1 middleIndex = 0 upperIndex = 1 } + else -> { lowerIndex = i middleIndex = i + 1 @@ -231,7 +237,7 @@ fun bbox(geometry: MultiPolygon) = computeBbox(geometry.coordAll()) * @return A [BoundingBox] that covers the geometry. */ @ExperimentalTurfApi -fun bbox(feature: Feature): BoundingBox = computeBbox(feature.coordAll() ?: emptyList()) +fun bbox(feature: Feature): BoundingBox = computeBbox(feature.coordAll() ?: emptyList()) /** * Takes a feature collection and calculates a bbox that covers all features in the collection. @@ -472,7 +478,7 @@ fun midpoint(point1: Position, point2: Position): Position { * @return A [Point] holding the center coordinates */ @ExperimentalTurfApi -fun center(feature: Feature): Point { +fun center(feature: Feature): Point { val ext = bbox(feature) val x = (ext.southwest.longitude + ext.northeast.longitude) / 2 val y = (ext.southwest.latitude + ext.northeast.latitude) / 2 diff --git a/turf/src/commonMain/kotlin/io/github/dellisd/spatialk/turf/Meta.kt b/turf/src/commonMain/kotlin/io/github/dellisd/spatialk/turf/Meta.kt index 21665c86..b29080c8 100644 --- a/turf/src/commonMain/kotlin/io/github/dellisd/spatialk/turf/Meta.kt +++ b/turf/src/commonMain/kotlin/io/github/dellisd/spatialk/turf/Meta.kt @@ -52,7 +52,7 @@ fun GeometryCollection.coordAll() = geometries.fold(emptyList()) { acc, geometry -> acc + geometry.coordAll() } @ExperimentalTurfApi -fun Feature.coordAll() = geometry?.coordAll() +fun Feature.coordAll() = geometry?.coordAll() @ExperimentalTurfApi fun FeatureCollection.coordAll() = diff --git a/turf/src/commonTest/kotlin/io/github/dellisd/spatialk/turf/BooleansTests.kt b/turf/src/commonTest/kotlin/io/github/dellisd/spatialk/turf/BooleansTests.kt index 5887bfdf..657a5da0 100644 --- a/turf/src/commonTest/kotlin/io/github/dellisd/spatialk/turf/BooleansTests.kt +++ b/turf/src/commonTest/kotlin/io/github/dellisd/spatialk/turf/BooleansTests.kt @@ -12,6 +12,7 @@ import kotlin.test.assertEquals import kotlin.test.assertFalse import kotlin.test.assertTrue +@OptIn(ExperimentalTurfApi::class) @ExperimentalSerializationApi class BooleansTests { @@ -61,7 +62,7 @@ class BooleansTests { val ptInHole = point(-86.69208526611328, 36.20373274711739) val ptInPoly = point(-86.72229766845702, 36.20258997094334) val ptOutsidePoly = point(-86.75079345703125, 36.18527313913089) - val polyHole = Feature.fromJson(readResource("booleans/in/poly-with-hole.geojson")).geometry as Polygon + val polyHole = Feature.fromJson(readResource("booleans/in/poly-with-hole.geojson")).geometry as Polygon assertFalse(booleanPointInPolygon(ptInHole, polyHole)) assertTrue(booleanPointInPolygon(ptInPoly, polyHole)) @@ -75,7 +76,7 @@ class BooleansTests { val ptInPoly2 = point(-86.75079345703125, 36.18527313913089) val ptOutsidePoly = point(-86.75302505493164, 36.23015046460186) val multiPolyHole = - Feature.fromJson(readResource("booleans/in/multipoly-with-hole.geojson")).geometry as MultiPolygon + Feature.fromJson(readResource("booleans/in/multipoly-with-hole.geojson")).geometry!! assertFalse(booleanPointInPolygon(ptInHole, multiPolyHole)) assertTrue(booleanPointInPolygon(ptInPoly, multiPolyHole)) diff --git a/turf/src/commonTest/kotlin/io/github/dellisd/spatialk/turf/TransformationTest.kt b/turf/src/commonTest/kotlin/io/github/dellisd/spatialk/turf/TransformationTest.kt index 2843f1e1..1807f453 100644 --- a/turf/src/commonTest/kotlin/io/github/dellisd/spatialk/turf/TransformationTest.kt +++ b/turf/src/commonTest/kotlin/io/github/dellisd/spatialk/turf/TransformationTest.kt @@ -11,18 +11,18 @@ class TransformationTest { @Test fun testBezierSplineIn() { - val feature = Feature.fromJson(readResource("transformation/bezierspline/in/bezierIn.json")) - val expectedOut = Feature.fromJson(readResource("transformation/bezierspline/out/bezierIn.json")) + val feature = Feature.fromJson(readResource("transformation/bezierspline/in/bezierIn.json")) + val expectedOut = Feature.fromJson(readResource("transformation/bezierspline/out/bezierIn.json")) - assertEquals(expectedOut.geometry, bezierSpline(feature.geometry as LineString)) + assertEquals(expectedOut.geometry, bezierSpline(feature.geometry!!)) } @Test fun testBezierSplineSimple() { - val feature = Feature.fromJson(readResource("transformation/bezierspline/in/simple.json")) - val expectedOut = Feature.fromJson(readResource("transformation/bezierspline/out/simple.json")) + val feature = Feature.fromJson(readResource("transformation/bezierspline/in/simple.json")) + val expectedOut = Feature.fromJson(readResource("transformation/bezierspline/out/simple.json")) - assertEquals(expectedOut.geometry, bezierSpline(feature.geometry as LineString)) + assertEquals(expectedOut.geometry, bezierSpline(feature.geometry!!)) } /** @@ -32,9 +32,9 @@ class TransformationTest { */ @Test fun testBezierSplineAcrossPacific() { - val feature = Feature.fromJson(readResource("transformation/bezierspline/in/issue-#1063.json")) - val expectedOut = Feature.fromJson(readResource("transformation/bezierspline/out/issue-#1063.json")) + val feature = Feature.fromJson(readResource("transformation/bezierspline/in/issue-#1063.json")) + val expectedOut = Feature.fromJson(readResource("transformation/bezierspline/out/issue-#1063.json")) - assertEquals(expectedOut.geometry, bezierSpline(feature.geometry as LineString)) + assertEquals(expectedOut.geometry, bezierSpline(feature.geometry!!)) } }