|
29 | 29 | import static org.junit.jupiter.api.Assertions.assertEquals; |
30 | 30 | import static org.junit.jupiter.api.Assertions.assertFalse; |
31 | 31 | import static org.junit.jupiter.api.Assertions.assertInstanceOf; |
| 32 | +import static org.junit.jupiter.api.Assertions.assertThrows; |
32 | 33 | import static org.junit.jupiter.api.Assertions.assertTrue; |
33 | 34 | import static org.junit.jupiter.api.Assertions.fail; |
34 | 35 | import static org.neo4j.gis.spatial.Constants.LABEL_LAYER; |
|
54 | 55 | import org.neo4j.gis.spatial.utilities.ReferenceNodes; |
55 | 56 | import org.neo4j.graphdb.GraphDatabaseService; |
56 | 57 | import org.neo4j.graphdb.Node; |
| 58 | +import org.neo4j.graphdb.QueryExecutionException; |
57 | 59 | import org.neo4j.graphdb.Result; |
58 | 60 | import org.neo4j.graphdb.Transaction; |
59 | 61 | import org.neo4j.graphdb.spatial.Geometry; |
@@ -1254,6 +1256,46 @@ public void testNativePoints() { |
1254 | 1256 | testCallCount(db, "CALL spatial.closest('line',{lon:5.1, lat:4.1}, 1.0)", null, 1); |
1255 | 1257 | } |
1256 | 1258 |
|
| 1259 | + @Test |
| 1260 | + public void testNativePoints3D() { |
| 1261 | + execute("CREATE (node:Foo { points: [point({latitude: 5.0, longitude: 4.0, height: 1.0}), point({latitude: 6.0, longitude: 5.0, height: 2.0})]})"); |
| 1262 | + Exception exception = assertThrows(QueryExecutionException.class, () -> { |
| 1263 | + execute("CALL spatial.addLayer('line','NativePoints','points:bbox:Cartesian') YIELD node" + |
| 1264 | + " MATCH (n:Foo)" + |
| 1265 | + " WITH collect(n) AS nodes" + |
| 1266 | + " CALL spatial.addNodes('line', nodes) YIELD count RETURN count"); |
| 1267 | + }); |
| 1268 | + |
| 1269 | + assertEquals( |
| 1270 | + "Failed to invoke procedure `spatial.addNodes`: Caused by: java.lang.IllegalStateException: Trying to decode geometry with wrong CRS: layer configured to crs=7203, but geometry has crs=4979", |
| 1271 | + exception.getMessage()); |
| 1272 | + } |
| 1273 | + |
| 1274 | + @Test |
| 1275 | + public void testNativePointsCartesian() { |
| 1276 | + execute("CREATE (node:Foo { points: [point({x: 5.0, y: 4.0}), point({x: 6.0, y: 5.0})]})"); |
| 1277 | + execute("CALL spatial.addLayer('line','NativePoints','points:bbox:Cartesian') YIELD node" + |
| 1278 | + " MATCH (n:Foo)" + |
| 1279 | + " WITH collect(n) AS nodes" + |
| 1280 | + " CALL spatial.addNodes('line', nodes) YIELD count RETURN count"); |
| 1281 | + testCallCount(db, "CALL spatial.closest('line',point({x:5.1, y:4.1}), 1.0)", null, 1); |
| 1282 | + } |
| 1283 | + |
| 1284 | + @Test |
| 1285 | + public void testNativePointsCartesian3D() { |
| 1286 | + execute("CREATE (node:Foo { points: [point({x: 5.0, y: 4.0, z: 1}), point({x: 6.0, y: 5.0, z: 2})]})"); |
| 1287 | + Exception exception = assertThrows(QueryExecutionException.class, () -> { |
| 1288 | + execute("CALL spatial.addLayer('line','NativePoints','points:bbox:Cartesian') YIELD node" + |
| 1289 | + " MATCH (n:Foo)" + |
| 1290 | + " WITH collect(n) AS nodes" + |
| 1291 | + " CALL spatial.addNodes('line', nodes) YIELD count RETURN count"); |
| 1292 | + }); |
| 1293 | + |
| 1294 | + assertEquals( |
| 1295 | + "Failed to invoke procedure `spatial.addNodes`: Caused by: java.lang.IllegalStateException: Trying to decode geometry with wrong CRS: layer configured to crs=7203, but geometry has crs=9157", |
| 1296 | + exception.getMessage()); |
| 1297 | + } |
| 1298 | + |
1257 | 1299 | /* |
1258 | 1300 |
|
1259 | 1301 | @Test |
|
0 commit comments