Bolt.Sips v2.0.5 Bolt.Sips.Types.Point View Source
Manage spatial data introduced in Bolt V2
Point can be:
- Cartesian 2D
- Geographic 2D
- Cartesian 3D
- Geographic 3D
Link to this section Summary
Functions
A 2D point either needs
Create a 3D point
Convert a Point struct into a cypher-compliant map
Link to this section Types
Link to this section Functions
Link to this function
create(arg1, x, y)
View Sourcecreate(:cartesian | :wgs_84 | 4326 | 7203, number(), number()) :: Bolt.Sips.Types.Point.t()
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)
%Bolt.Sips.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)
%Bolt.Sips.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)
View Sourcecreate(:cartesian | :wgs_84 | 4979 | 9157, number(), number(), number()) :: Bolt.Sips.Types.Point.t()
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)
%Bolt.Sips.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)
%Bolt.Sips.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)
View Sourceformat_param(Bolt.Sips.Types.Point.t()) :: {:ok, map()} | {:error, any()}
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}