Module: Queries::GeographicItem

Defined in:
lib/queries/geographic_item/filter.rb

Defined Under Namespace

Classes: Filter

Class Method Summary collapse

Class Method Details

.st_union(geographic_item_scope) ⇒ Object

DEPRECATED, unused



5
6
7
8
9
10
11
# File 'lib/queries/geographic_item/filter.rb', line 5

def self.st_union(geographic_item_scope)
  ::GeographicItem
    .select(
      ::GeographicItem.st_union_sql(::GeographicItem.geography_as_geometry)
    )
    .where(id: geographic_item_scope.pluck(:id))
end

.st_union_text(geographic_item_scope) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/queries/geographic_item/filter.rb', line 13

def self.st_union_text(geographic_item_scope)
  ::GeographicItem
    .with(u:
      ::GeographicItem
        .select(
          ::GeographicItem
            .st_union_sql(::GeographicItem.geography_as_geometry)
        )
        .where(id: geographic_item_scope.pluck(:id))
    )
    .from('u')
    .select(
      ::GeographicItem.st_as_text_sql(Arel.sql('u.st_union')),
      ::GeographicItem.st_geometry_type(Arel.sql('u.st_union'))
    )
end