1
votes

I have a CSV file with 3 columns labeled, ID, latitude, longitude. I want to load the CSV file into Neo4j and create nodes with the above properties. The Location: property should be a point data type with latitude and longitude sub-properties.

CSV is:

ID,latitude,longitude
84,39.5990448,-104.75835419
etc...

So the start of the query would be:

LOAD CSV WITH Headers FROM 'http...' AS line
CREATE (:Node_Label {ID: line.ID, Location:????

How do I format the second property to import as a point type?

1

1 Answers

1
votes

It is pretty simple:

LOAD CSV WITH Headers FROM 'http...' AS line
CREATE (:Node_Label {
  ID: line.ID,
  Location: point({
    latitude: TOFLOAT(line.latitude),
    longitude: TOFLOAT(line.longitude)
  })
})