How to add list of nodes to a SpatialLayer

老子叫甜甜 提交于 2019-12-04 05:10:54

问题


I'm new to Neo4j and cypher.
I have many nodes, that i want to add to a spatial layer.
This is what i tried with cypher :

Creating Nodes from a csv file

load csv with headers from "file:///green_tripdata_2015-02.csv" as line
create(pl:pickup_location{lat:line.Pickup_latitude,lon:line.Pickup_longitude});


Spatial Layer Creation

CALL spatial.addPointLayer('nyc');

and then :

MATCH (pl:pickup_location)
WITH collect(pl) AS pickup
CALL spatial.addNodes('nyc',pickup) YIELD count
RETURN count

and i get this error :

 Neo.ClientError.Statement.PropertyNotFound: NODE[397] has no property with propertyKeyId=8.

what is wrong ?


回答1:


I Solved my problem by just changing:

1) lat property to latitude
2) lon property to longitude
3) cast with toFloat() the two properties(they were Strings in the csv):

toFloat(line.Pickup_latitude) and toFloat(line.Pickup_longitude)



来源:https://stackoverflow.com/questions/50861988/how-to-add-list-of-nodes-to-a-spatiallayer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!