Spatial Data Types¶
Cypher has built-in support for handling spatial values (points), and the underlying database supports storing these point values as properties on nodes and relationships.
https://neo4j.com/docs/cypher-manual/current/syntax/spatial/
Cypher Type |
Python Type |
---|---|
Point |
|
Point (Cartesian) |
|
Point (WGS-84) |
Point¶
- class neo4j.spatial.Point(iterable)¶
Bases:
Tuple
[float
, …]Base-class for spatial data.
A point within a geometric space. This type is generally used via its subclasses and should not be instantiated directly unless there is no subclass defined for the required SRID.
CartesianPoint¶
Examples¶
from neo4j.spatial import CartesianPoint
point = CartesianPoint((1.23, 4.56))
print(point.x, point.y, point.srid)
# 1.23 4.56 7203
from neo4j.spatial import CartesianPoint
point = CartesianPoint((1.23, 4.56, 7.89))
print(point.x, point.y, point.z, point.srid)
# 1.23 4.56 7.8 9157
WGS84Point¶
Examples¶
from neo4j.spatial import WGS84Point
point = WGS84Point((1.23, 4.56))
print(point.longitude, point.latitude, point.srid)
# 1.23 4.56 4326
from neo4j.spatial import WGS84Point
point = WGS84Point((1.23, 4.56, 7.89))
print(point.longitude, point.latitude, point.height, point.srid)
# 1.23 4.56 7.89 4979