interior 0.8.1 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -3,13 +3,29 @@ Interior
3
3
 
4
4
  Township GeoCoder Web Service
5
5
  -----------------------------
6
- This gem uses the GeoCommunicator GeoCoder Web Service provided by the
6
+ Interior uses the GeoCommunicator GeoCoder Web Service provided by the
7
7
  [US Department of the Interior] [1]. For detailed documentation on the web service API, consult the
8
8
  [Methods, Parameters, and Results PDF] [2].
9
9
 
10
10
  [1]: http://www.geocommunicator.gov/GeoComm/lsis_home/townshipdecoder/index.htm "US Department of the Interior"
11
11
  [2]: http://www.blm.gov/nils/GeoComm/documents/NILS_GeoCommunicator_Web_Services_TGC_Formats.pdf "Methods, Parameters, and Results PDF"
12
12
 
13
+ Usage
14
+ -----
15
+ Given township `1N`, range `1E`, section `35`, and meridian `14` (see the US Meridian table below, this is the Gila-Salt River meridian), we can get the center point latitude and longitude in the state of Arizona with:
16
+
17
+ require 'interior'
18
+ response = Interior::Geocoder.get_lat_lon('AZ', 14, 1, 'N', 1, 'E', 35)
19
+ response.latitude => 33.384549272498
20
+ response.longitude => -112.228362739723
21
+
22
+ Section is option. If omitted, the centerpoint latitude and longitude will be for the township and range:
23
+
24
+ require 'interior'
25
+ response = Interior::Geocoder.get_lat_lon('AZ', 14, 1, 'N', 1, 'E') # No section
26
+ response.latitude => 33.4211630233451
27
+ response.longitude => -112.254699834217
28
+
13
29
  US Meridian Map
14
30
  ---------------
15
31
  The US is divided into several meridians. A [larger map] [3] and table are available for reference.
@@ -18,6 +34,7 @@ The US is divided into several meridians. A [larger map] [3] and table are avail
18
34
 
19
35
  [3]: https://github.com/climate/interior/raw/master/maps/meridians.jpg "Larger Map"
20
36
 
37
+
21
38
  US Meridian Table
22
39
  -----------------
23
40
  Each meridian has a corresponding numeric key mapping:
@@ -16,7 +16,7 @@ module Interior
16
16
  # ra : range
17
17
  # ra_dir : range_direction
18
18
  # se : section
19
- def self.get_lat_lon(st, me, to, to_dir, ra, ra_dir, se)
19
+ def self.get_lat_lon(st, me, to, to_dir, ra, ra_dir, se = nil)
20
20
  trs = build_trs_param(st, me, to, to_dir, ra, ra_dir, se)
21
21
  xml = get_response_body(trs)
22
22
  result = parse_xml(xml)
@@ -1,3 +1,3 @@
1
1
  module Interior
2
- VERSION = "0.8.1"
2
+ VERSION = "0.8.2"
3
3
  end
@@ -5,22 +5,32 @@ describe Interior::Geocoder do
5
5
  let(:coder) { Interior::Geocoder }
6
6
 
7
7
  describe '#get_lat_lon' do
8
+ let (:st) { 'AZ' }
9
+ let (:me) { 14 }
10
+ let (:to) { 1 }
11
+ let (:to_dir) { 'N' }
12
+ let (:ra) { 1 }
13
+ let (:ra_dir) { 'E' }
14
+
8
15
  subject { coder.get_lat_lon(st, me, to, to_dir, ra, ra_dir, se) }
9
16
 
10
- context 'when in Arizona' do
11
- let (:st) { 'AZ' }
12
- let (:me) { 14 }
13
- let (:to) { 1 }
14
- let (:to_dir) { 'N' }
15
- let (:ra) { 1 }
16
- let (:ra_dir) { 'E' }
17
- let (:se) { 35 }
17
+ context 'with section' do
18
+ let (:se) { 35 }
18
19
 
19
20
  it 'returns the correct latitude and longitude' do
20
21
  subject.latitude.should == 33.384549272498
21
22
  subject.longitude.should == -112.228362739723
22
23
  end
23
24
  end
25
+
26
+ context 'without section' do
27
+ let (:se) { nil }
28
+
29
+ it 'returns the correct latitude and longitude' do
30
+ subject.latitude.should == 33.4211630233451
31
+ subject.longitude.should == -112.254699834217
32
+ end
33
+ end
24
34
  end
25
35
 
26
36
  describe '#build_trs_param' do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: interior
3
3
  version: !ruby/object:Gem::Version
4
- hash: 61
4
+ hash: 59
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 8
9
- - 1
10
- version: 0.8.1
9
+ - 2
10
+ version: 0.8.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Chris Hunt