Boltx.Types.Point (Boltx v0.0.6)
Manage spatial data introduced in Bolt V2
Point can be:
- Cartesian 2D
- Geographic 2D
- Cartesian 3D
- Geographic 3D
Summary
Functions
A 2D point either needs
Create a 3D point
Convert a Point struct into a cypher-compliant map
Types
Functions
Link to this function
create(arg1, x, y)
A 2D point either needs:
- 2 coordinates and a atom (:cartesian or :wgs_84) to define its type
- 2 coordinates and a srid (4326 or 7203) to define its type
Examples:
iex> Point.create(:cartesian, 10, 20.0)
%Boltx.Types.Point{
crs: "cartesian",
height: nil,
latitude: nil,
longitude: nil,
srid: 7203,
x: 10.0,
y: 20.0,
z: nil
}
iex> Point.create(4326, 10, 20.0)
%Boltx.Types.Point{
crs: "wgs-84",
height: nil,
latitude: 20.0,
longitude: 10.0,
srid: 4326,
x: 10.0,
y: 20.0,
z: 30.0
}
Link to this function
create(arg1, x, y, z)
Create a 3D point
A 3D point either needs:
- 3 coordinates and a atom (:cartesian or :wgs_84) to define its type
- 3 coordinates and a srid (4979 or 9147) to define its type
Examples:
iex> Point.create(:cartesian, 10, 20.0, 30)
%Boltx.Types.Point{
crs: "cartesian-3d",
height: nil,
latitude: nil,
longitude: nil,
srid: 9157,
x: 10.0,
y: 20.0,
z: 30.0
}
iex> Point.create(4979, 10, 20.0, 30)
%Boltx.Types.Point{
crs: "wgs-84-3d",
height: 30.0,
latitude: 20.0,
longitude: 10.0,
srid: 4979,
x: 10.0,
y: 20.0,
z: 30.0
}
Link to this function
format_param(point)
Convert a Point struct into a cypher-compliant map
Example
iex(8)> Point.create(4326, 10, 20.0) |> Point.format_to_param
%{crs: "wgs-84", latitude: 20.0, longitude: 10.0, x: 10.0, y: 20.0}