Class: APDM::LocalPaperArea

Inherits:
Object
  • Object
show all
Defined in:
lib/apdm/local_paper_area.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(geojson) ⇒ LocalPaperArea

Returns a new instance of LocalPaperArea.



8
9
10
11
# File 'lib/apdm/local_paper_area.rb', line 8

def initialize(geojson)
  @factory = RGeo::Geographic.spherical_factory
  @feature = RGeo::GeoJSON.decode(geojson, :json_parser => :json)
end

Instance Attribute Details

#factoryObject (readonly)

Returns the value of attribute factory.



7
8
9
# File 'lib/apdm/local_paper_area.rb', line 7

def factory
  @factory
end

#featureObject (readonly)

Returns the value of attribute feature.



7
8
9
# File 'lib/apdm/local_paper_area.rb', line 7

def feature
  @feature
end

Instance Method Details

#contains?(lon, lat) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/apdm/local_paper_area.rb', line 13

def contains?(lon, lat)
  feature.contains? factory.point(lon, lat)
end