In Neo4j 3.0 you can also use the distance function for "close enough"
connections
Make sure to create an index on :GeoCoordinates(postalCode);
LOAD CSV WITH HEADERS FROM "file:/event.csv" AS row
MATCH (g :GeoCoordinates {postalCode: row.zip})
// distance in meters
WHERE distance( point ({latitude: toFloat(row.Latitude), longitude:
toFloat(row.Longitude)}), point(g)) < 10
CREATE (e:Event)-[r :location]->(g);
Don't forget to set some data from the csv on the Event or location
relationship.
> Am 12.05.2016 um 01:53 schrieb Joseph Wu <[email protected]>:
>
> I have csv files with latitude and longitude data.
>
> I load the place tables.
>
> USING PERIODIC COMMIT
>
> LOAD CSV WITH HEADERS FROM "file:/place.csv" AS row
>
> Create (g :GeoCoordinates {latitude: row.Latitude, longitude: row.Longitude,
> postalCode: row.zip})
>
>
> Then I want to link with event tables.
>
>
>
> USING PERIODIC COMMIT
>
> LOAD CSV WITH HEADERS FROM "file:/event.csv" AS row
>
> Match (g :GeoCoordinates {latitude: row.Latitude, longitude: row.Longitude,
> postalCode: row.zip})
>
> Create (e :Event)-[r :location]->(g)
>
>
>
> But I got problem from precision.
>
> For example, assume a latitude is -75.0715026855469
>
> and it become -75.07150269 in GeoCoordinates node.
>
>
>
> Then I got nothing because -75.0715026855469 and -75.07150269 not match
>
>
>
> I try the following approach
>
>
>
> USING PERIODIC COMMIT
>
> LOAD CSV WITH HEADERS FROM "file:/place.csv" AS row
>
> Create (g :GeoCoordinates {latitude: toFloat(row.Latitude), longitude:
> toFloat(row.Longitude), postalCode: row.zip})
>
>
> USING PERIODIC COMMIT
>
>
> LOAD CSV WITH HEADERS FROM "file:/event.csv" AS row
>
> Match (g :GeoCoordinates {latitude: toFloat(row.Latitude), longitude:
> toFloat(row.Longitude), postalCode: row.zip})
>
> Create (e :Event)-[r :location]->(g)
>
>
>
> Still not work.
>
> How to fix this?
>
>
>
> Thanks
>
>
>
>
>
> Joseph
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.