I have a table that has columns for person name, their location, day, month and year as well as longitude and latitude of the location which I have imported into Neo4j. I am trying to structure a query that that would identify people that where within 20 km of each other at any day, that can automatically run through all the rows of the tables/nodes. Is there a way of doing this using the spatial function in neo4j, I am stuck and would need some ideas/help.
That's going to be quite a query as you'll have to compare every person's location with every other person's location on the same day (a cartensian product) which can rapidly slow down your query as the number of people increases.
That aside, if you have stored the lat and long data in a geospatial 'point' you can use the 'distance()' funtion to work out the distance between two points in the units the point data is stored in.
I'm going to think a bit more about the cartesian product part of the problem.
Quick question, I am running a cypher query which continues to crash my machine. and not reaching the stage to produce results. Is there a way I can change and make this query efficient so that I can get some result?
WITH c, c1, Site
ORDER BY c, Site.year
WITH c, c1, collect(Site).year AS year, count(*) AS collaborations WHERE year>1801
SET cocollector.collaborations = collaborations