Class: GeographicItem::Polygon

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

Overview

Polygon definition…

Constant Summary collapse

SHAPE_COLUMN =
:polygon

Constants inherited from GeographicItem

ANTI_MERIDIAN, DATA_TYPES, GEOGRAPHY_SQL, GEOMETRY_SQL

Instance Attribute Summary

Attributes inherited from GeographicItem

#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, 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?, 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, #inferred_geographic_name_hierarchy, intersecting, #intersecting_area, intersecting_radius_of_wkt_sql, #intersects?, 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, 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_centroid, st_collect, st_collect_sql, #st_distance, #st_distance_spheroid, #st_distance_to_geographic_item, 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::Timestamps

#data_breakdown_for_chartkick_recent

Methods included from Housekeeping::Users

#set_created_by_id, #set_updated_by_id

Methods inherited from ApplicationRecord

transaction_with_retry

Instance Method Details

#keystone_error_boxObject



22
23
24
# File 'app/models/geographic_item/polygon.rb', line 22

def keystone_error_box
  geo_object
end

#rendering_hashHash

Returns:

  • (Hash)


18
19
20
# File 'app/models/geographic_item/polygon.rb', line 18

def rendering_hash
  polygon_to_hash(self.polygon)
end

#st_start_pointRGeo::Point

Returns first point in the polygon.

Returns:

  • (RGeo::Point)

    first point in the polygon



13
14
15
# File 'app/models/geographic_item/polygon.rb', line 13

def st_start_point
  geo_object.exterior_ring.point_n(0)
end

#to_aArray

Returns arrays of points.

Returns:

  • (Array)

    arrays of points



8
9
10
# File 'app/models/geographic_item/polygon.rb', line 8

def to_a
  polygon_to_a(self.polygon)
end