Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for native point array properties #404

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Andy2003
Copy link
Collaborator

This introduces a new Encoder that allows to index native point arrays like this:

CREATE (node:Foo { points: [point({latitude: 5.0, longitude: 4.0}), point({latitude: 6.0, longitude: 5.0})]});

CALL spatial.addLayer('line','NativePoints','points') YIELD node
MATCH (n:Foo)
WITH collect(n) AS nodes
CALL spatial.addNodes('line', nodes) YIELD count RETURN count;

@Andy2003 Andy2003 requested a review from jexp May 29, 2024 16:50
@Andy2003 Andy2003 force-pushed the feature/add-support-for-point-arrays branch from 3769093 to 848eb29 Compare May 30, 2024 11:25
@Andy2003 Andy2003 force-pushed the feature/add-support-for-point-arrays branch from 848eb29 to bcb30fd Compare May 31, 2024 14:45
Copy link
Contributor

@craigtaverner craigtaverner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice enhancement. I did have some suggestions though.

}
double[] coordinate = point.getCoordinate().getCoordinate();
if (crs.dimensions() == 3) {
return new Coordinate(coordinate[0], coordinate[1], coordinate[2]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we enforce all points to have the same dimension? So get the dimension from the first, and ensure all others are the same? I see you assert on the CRS, so this would be similar.

Actually, we assert that the CRS is WGS84, which is explicitly 2D, so perhaps we should reject all 3d points, or ignore the third dimension?


@Override
public String getConfiguration() {
return property + ":" + bboxProperty + ": " + crs.getCode();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we support more than WG84, we should also have tests for that.

@@ -1244,6 +1244,16 @@ public void find_no_geometries_using_closest_on_empty_layer() {
testCallCount(db, "CALL spatial.closest('geom',{lon:15.2, lat:60.1}, 1.0)", null, 0);
}

@Test
public void testNativePoints() {
execute("CREATE (node:Foo { points: [point({latitude: 5.0, longitude: 4.0}), point({latitude: 6.0, longitude: 5.0})]})");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps a test for 3D or non-WGS84 data?

@Andy2003 Andy2003 force-pushed the master branch 5 times, most recently from 6844765 to bee28a4 Compare June 20, 2024 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants