Class: GeographicItem::Point

Inherits:
GeographicItem
  • Object
show all
Defined in:
app/models/geographic_item/point.rb

Overview

A geographic point.

Constant Summary collapse

SHAPE_COLUMN =
:point

Instance Method Summary collapse

Instance Method Details

#check_point_limitsBoolean (protected)

true iff point.x is between -180.0 and +180.0

Returns:

  • (Boolean)


27
28
29
30
31
# File 'app/models/geographic_item/point.rb', line 27

def check_point_limits
  unless point.nil?
    errors.add(:point_limit, 'Longitude exceeds limits: 180.0 to -180.0.') if point.x > 180.0 || point.x < -180.0
  end
end

#rendering_hashHash

Returns:

  • (Hash)


19
20
21
# File 'app/models/geographic_item/point.rb', line 19

def rendering_hash
  point_to_hash(self.point)
end

#st_start_pointRGeo::Point

Returns the first POINT of self.

Returns:

  • (RGeo::Point)

    the first POINT of self



14
15
16
# File 'app/models/geographic_item/point.rb', line 14

def st_start_point
  self.geo_object
end

#to_aArray

Returns a point.

Returns:

  • (Array)

    a point



9
10
11
# File 'app/models/geographic_item/point.rb', line 9

def to_a
  point_to_a(self.point)
end