Class: GeographicItem::Point

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

Overview

A geographic point.

Constant Summary collapse

SHAPE_COLUMN =
:point

Constants inherited from GeographicItem

ANTI_MERIDIAN, DATA_TYPES, GEOGRAPHY_SQL, GEOMETRY_SQL

Instance Attribute Summary

Attributes inherited from GeographicItem

#cached_total_area, #geometry, #line_string, #multi_line_string, #multi_point, #multi_polygon, #no_cached, #point, #polygon, #shape, #type

Attributes included from Housekeeping::Users

#by

Instance Method Summary collapse

Methods inherited from GeographicItem

aliased_geographic_sql, #align_winding, are_contained_in_item, are_contained_in_item_by_id, are_contained_in_wkt, #area, #center_coords, #centroid, contained_by, contained_by_where_sql, contained_by_with_antimeridian_check, contained_by_wkt_shifted_sql, contained_by_wkt_sql, containing, #containing_geographic_areas, containing_point, containing_sql, containing_where_for_point_sql, containing_where_sql, containing_where_sql_geog, #contains?, crosses_anti_meridian?, crosses_anti_meridian_by_id?, debug_draw, default_by_geographic_area_ids, disjoint_from, distance_between, eval_for_type, #far, #geo_object, #geo_object_type, #geo_type, #geographic_name_hierarchy, geometry_for, geometry_for_collection_sql, geometry_for_sql, geometry_sql, geometry_sql2, #has_polygons?, #inferred_geographic_name_hierarchy, intersecting, #intersecting_area, intersecting_radius_of_wkt_sql, #intersects?, #is_basic_donut?, is_contained_by, is_contained_by_sql, lat_long_sql, #line_string_to_a, #line_string_to_hash, #multi_line_string_to_a, #multi_line_string_to_hash, #multi_point_to_a, #multi_point_to_hash, #multi_polygon_to_a, #multi_polygon_to_hash, #near, not_including, ordered_by_longest_distance_from, ordered_by_shortest_distance_from, #orientations, point_inferred_geographic_name_hierarchy, #point_to_a, #point_to_hash, #polygon_to_a, #polygon_to_hash, #quick_geographic_name_hierarchy, #radius, reverse_containing_sql, #rgeo_to_geo_json, select_distance_with_geo_object, select_geography_sql, select_geometry_sql, #set_cached, #set_type_if_geography_present, single_geometry_sql, #some_data_is_provided, st_buffer_st_within, #st_centroid, st_collect, st_collect_sql, #st_distance, #st_distance_spheroid, #st_distance_to_geographic_item, #st_isvalid, #st_isvalidreason, st_multi, #st_npoints, st_union, #start_point, #to_geo_json, #to_geo_json_feature, #to_geo_json_string, #to_wkt, #valid_geometry?, where_distance_greater_than_zero, with_area, with_collecting_event_through_georeferences, with_is_valid_geometry_column, with_latitude, with_longitude, #within?, within_radius_of_item, within_radius_of_item_sql, within_radius_of_wkt_sql

Methods included from Shared::IsData

#errors_excepting, #full_error_messages_excepting, #identical, #is_community?, #is_destroyable?, #is_editable?, #is_in_use?, #is_in_users_projects?, #metamorphosize, #similar

Methods included from Shared::HasPapertrail

#attribute_updated, #attribute_updater

Methods included from Housekeeping::Users

#set_created_by_id, #set_updated_by_id

Methods inherited from ApplicationRecord

transaction_with_retry

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