Skip to content

Commit

Permalink
fix: longitude and latitude mapping 4.1 (#635)
Browse files Browse the repository at this point in the history
  • Loading branch information
Emrehzl94 authored Jul 30, 2024
1 parent bdc1c1b commit 27e9d4d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions common/src/main/kotlin/streams/utils/JSONUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ import kotlin.reflect.full.isSubclassOf
abstract class StreamsPoint { abstract val crs: String }
data class StreamsPointCartesian2D(override val crs: String, val x: Double, val y: Double): StreamsPoint()
data class StreamsPointCartesian3D(override val crs: String, val x: Double, val y: Double, val z: Double): StreamsPoint()
data class StreamsPointWgs2D(override val crs: String, val latitude: Double, val longitude: Double): StreamsPoint()
data class StreamsPointWgs3D(override val crs: String, val latitude: Double, val longitude: Double, val height: Double): StreamsPoint()
data class StreamsPointWgs2D(override val crs: String, val longitude: Double, val latitude: Double): StreamsPoint()
data class StreamsPointWgs3D(override val crs: String, val longitude: Double, val latitude: Double, val height: Double): StreamsPoint()

fun Point.toStreamsPoint(): StreamsPoint {
val crsType = this.crs.type
Expand Down
8 changes: 4 additions & 4 deletions common/src/test/kotlin/streams/utils/JSONUtilsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class JSONUtilsTest {
// Given
val expected = "{\"point2dCartesian\":{\"crs\":\"cartesian\",\"x\":1.0,\"y\":2.0}," +
"\"point3dCartesian\":{\"crs\":\"cartesian-3d\",\"x\":1.0,\"y\":2.0,\"z\":3.0}," +
"\"point2dWgs84\":{\"crs\":\"wgs-84\",\"latitude\":1.0,\"longitude\":2.0}," +
"\"point3dWgs84\":{\"crs\":\"wgs-84-3d\",\"latitude\":1.0,\"longitude\":2.0,\"height\":3.0}," +
"\"point2dWgs84\":{\"crs\":\"wgs-84\",\"longitude\":1.0,\"latitude\":2.0}," +
"\"point3dWgs84\":{\"crs\":\"wgs-84-3d\",\"longitude\":1.0,\"latitude\":2.0,\"height\":3.0}," +
"\"time\":\"14:00:00Z\",\"dateTime\":\"2017-12-17T17:14:35.123456789Z\"}"
val map = linkedMapOf<String, Any>("point2dCartesian" to pointValue(Cartesian, 1.0, 2.0),
"point3dCartesian" to pointValue(Cartesian_3D, 1.0, 2.0, 3.0),
Expand All @@ -50,8 +50,8 @@ class JSONUtilsTest {
// Given
val expected = "{\"point2dCartesian\":{\"crs\":\"cartesian\",\"x\":1.0,\"y\":2.0}," +
"\"point3dCartesian\":{\"crs\":\"cartesian-3d\",\"x\":1.0,\"y\":2.0,\"z\":3.0}," +
"\"point2dWgs84\":{\"crs\":\"wgs-84\",\"latitude\":1.0,\"longitude\":2.0}," +
"\"point3dWgs84\":{\"crs\":\"wgs-84-3d\",\"latitude\":1.0,\"longitude\":2.0,\"height\":3.0}," +
"\"point2dWgs84\":{\"crs\":\"wgs-84\",\"longitude\":1.0,\"latitude\":2.0}," +
"\"point3dWgs84\":{\"crs\":\"wgs-84-3d\",\"longitude\":1.0,\"latitude\":2.0,\"height\":3.0}," +
"\"time\":\"14:00:00Z\",\"dateTime\":\"2017-12-17T17:14:35.123456789Z\"}"
val map = linkedMapOf<String, Any>("point2dCartesian" to pointValue(Cartesian, 1.0, 2.0),
"point3dCartesian" to Values.point(Cartesian_3D.code, 1.0, 2.0, 3.0),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class KafkaEventRouterSimpleTSE: KafkaEventRouterBaseTSE() {
fun testCreateNodeWithPointValue() {
db.start()
kafkaConsumer.subscribe(listOf("neo4j"))
db.execute("CREATE (:Person {name:'John Doe', age:42, bornIn: point({longitude: 12.78, latitude: 56.7, height: 100})})")
db.execute("CREATE (:Person {name:'John Doe', age:42, bornIn: point({latitude: 12.78, longitude: 56.7, height: 100})})")
val records = kafkaConsumer.poll(5000)
assertEquals(1, records.count())
assertEquals(true, records.all {
Expand Down

0 comments on commit 27e9d4d

Please sign in to comment.