cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Storing Geometry coordinates in neo4j

Hi, I'm loading data to neo4j DB using python script via py2neo api. I have a use case where I have a 'Geometry' field which is going to be populated as a pair of numbers which will corresponds to Latitude and Longitude, like: 'Geometry':[48.965, 7.456]. Is there a way to add this Geometry object as a list of number in neo4j. Does neo4j supports the attribute values to be of list or array type ?
If so, how can it be done via py2neo api.

2 REPLIES 2

I would suggest to use neo4j's point type, and not use an array of numbers - these will be easier to query, and Neo4j has built-in spatial functions that will let you work with data like that

py2neo looks like it supports spatial types here:

and you would need to use wgs842d to represent your points with latitude and longitude (read this: https://neo4j.com/docs/cypher-manual/current/syntax/spatial/#cypher-spatial-crs-geographic)

In the continuation of the above thread, i wanted to know if there is a way to add Multipoint like MULTIPOINT ((10 40), (40 30), (20 20), (30 10))
Or
MULTIPOINT (10 40, 40 30, 20 20, 30 10)
in neo4j. I'm able to add Point as an attribute to a node using the following code from python

import py2neo.data.spatial as sp
point = sp.WGS84Point((4.123, 7.345))

But it seems like py2neo has support only for points which includes 'CartesianPoint' and 'WGS84Point'.
Is there a way to add Multipoint as an attribute too ?

Thanks

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online