Class: Satellite::Landsat8::CoordinateConverterService
- Inherits:
-
Object
- Object
- Satellite::Landsat8::CoordinateConverterService
- Includes:
- HTTParty
- Defined in:
- lib/satellite/landsat8/coordinate_converter_service.rb
Instance Attribute Summary collapse
-
#lat ⇒ Object
Returns the value of attribute lat.
-
#lon ⇒ Object
Returns the value of attribute lon.
Instance Method Summary collapse
- #convert ⇒ Object
-
#initialize(lat, lon) ⇒ CoordinateConverterService
constructor
A new instance of CoordinateConverterService.
Constructor Details
#initialize(lat, lon) ⇒ CoordinateConverterService
Returns a new instance of CoordinateConverterService.
11 12 13 14 |
# File 'lib/satellite/landsat8/coordinate_converter_service.rb', line 11 def initialize(lat, lon) self.lat = lat self.lon = lon end |
Instance Attribute Details
#lat ⇒ Object
Returns the value of attribute lat.
9 10 11 |
# File 'lib/satellite/landsat8/coordinate_converter_service.rb', line 9 def lat @lat end |
#lon ⇒ Object
Returns the value of attribute lon.
9 10 11 |
# File 'lib/satellite/landsat8/coordinate_converter_service.rb', line 9 def lon @lon end |
Instance Method Details
#convert ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/satellite/landsat8/coordinate_converter_service.rb', line 16 def convert response = self.class.get('/query', { query: { where: "MODE='D'", geometry: "#{lon}, #{lat}", geometryType: 'esriGeometryPoint', spatialRel: 'esriSpatialRelIntersects', outFields: '*', returnGeometry: false, returnTrueCurves: false, returnIdsOnly: false, returnCountOnly: false, returnZ: false, returnM: false, returnDistinctValues: false, f: 'json' }.to_param }) result = JSON.parse(response).dig('features', 0, 'attributes') "#{result['PATH'].to_s.rjust(3, '0')}#{result['ROW'].to_s.rjust(3, '0')}" end |