Class: Neo4j::Driver::Types::Point

Inherits:
Object
  • Object
show all
Defined in:
lib/neo4j/driver/types/point.rb

Constant Summary collapse

SRID =
{
  'WGS-84': 4326,
  'WGS-84-3D': 4979,
  cartesian: 7203,
  'cartesian-3D': 9157
}.with_indifferent_access.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Point

Returns a new instance of Point.



16
17
18
19
20
21
# File 'lib/neo4j/driver/types/point.rb', line 16

def initialize(args)
  self.x = args[:longitude] || args[:x]
  self.y = args[:latitude] || args[:y]
  self.z = args[:height] || args[:z]
  self.srid = args[:srid] || SRID[args[:crs] || implied_crs(args[:longitude] || args[:latitude])]
end

Instance Attribute Details

#sridObject

Returns the value of attribute srid.



7
8
9
# File 'lib/neo4j/driver/types/point.rb', line 7

def srid
  @srid
end

#xObject

Returns the value of attribute x.



7
8
9
# File 'lib/neo4j/driver/types/point.rb', line 7

def x
  @x
end

#yObject

Returns the value of attribute y.



7
8
9
# File 'lib/neo4j/driver/types/point.rb', line 7

def y
  @y
end

#zObject

Returns the value of attribute z.



7
8
9
# File 'lib/neo4j/driver/types/point.rb', line 7

def z
  @z
end

Instance Method Details

#coordinatesObject



23
24
25
# File 'lib/neo4j/driver/types/point.rb', line 23

def coordinates
  [x, y, z].compact.map(&:to_f)
end