miami_dade_geo 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 210a82e58eb4f992fa654034a01607526b98802a
|
4
|
+
data.tar.gz: 10d42cedd1ca2c88dd62fe9d6d5ba8842a487519
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 389e3de1c57bab9936f87708e8c40b96cce18d71620d492f01b1df1b87907a96645f5e32550e528a6e6f9984dcbcb2a54db2c630ced36cdb50d36047696ad1c7
|
7
|
+
data.tar.gz: 829b850d956e8a7b3dac2ca62bf71f63470a3b48842a4a2bb0cfd4a39147d062bed4e5acc1f1303e51f3c133df9e8164ac5849d3deb58492cc0fe7bff3697cd8
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'miami_dade_geo/addr_xy_client'
|
2
2
|
require 'miami_dade_geo/latlong_client'
|
3
3
|
require 'miami_dade_geo/municipality'
|
4
|
+
require 'miami_dade_geo/errors/invalid_address_error'
|
4
5
|
|
5
6
|
module MiamiDadeGeo
|
6
7
|
class Address
|
@@ -39,6 +40,7 @@ module MiamiDadeGeo
|
|
39
40
|
end
|
40
41
|
|
41
42
|
private
|
43
|
+
|
42
44
|
def latlong
|
43
45
|
return @latlong if defined? @latlong
|
44
46
|
body = latlong_client.
|
@@ -51,8 +53,8 @@ module MiamiDadeGeo
|
|
51
53
|
double = result[:double]
|
52
54
|
|
53
55
|
@latlong = {
|
54
|
-
|
55
|
-
|
56
|
+
long: double[0].to_f,
|
57
|
+
lat: double[1].to_f
|
56
58
|
}
|
57
59
|
end
|
58
60
|
|
@@ -63,6 +65,10 @@ module MiamiDadeGeo
|
|
63
65
|
call(:xy_address, message: { myAddress: address}).
|
64
66
|
body
|
65
67
|
|
68
|
+
if body[:xy_address_response][:xy_address_result][:count] == '0'
|
69
|
+
raise MiamiDadeGeo::InvalidAddressError
|
70
|
+
end
|
71
|
+
|
66
72
|
@xy_addr = body[:xy_address_response][:xy_address_result][:xy][:arr_xy]
|
67
73
|
end
|
68
74
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'miami_dade_geo/geo_attribute_client'
|
2
2
|
require 'miami_dade_geo/get_closest_feature_client'
|
3
|
+
require 'miami_dade_geo/latlong_client'
|
3
4
|
|
4
5
|
module MiamiDadeGeo
|
5
6
|
class Municipality
|
@@ -44,6 +45,20 @@ module MiamiDadeGeo
|
|
44
45
|
new poly
|
45
46
|
end
|
46
47
|
|
48
|
+
def self.new_with_latlong(latlong_hash)
|
49
|
+
body = LatlongClient.instance.savon.
|
50
|
+
call(:get_x_yfrom_lat_long_dec,
|
51
|
+
message: { 'LNG' => latlong_hash[:long].to_f,
|
52
|
+
'LAT' => latlong_hash[:lat].to_f} ).
|
53
|
+
body
|
54
|
+
|
55
|
+
resp = body[:get_x_yfrom_lat_long_dec_response]
|
56
|
+
result = resp[:get_x_yfrom_lat_long_dec_result]
|
57
|
+
double = result[:double]
|
58
|
+
|
59
|
+
new_with_xy(x: double[0], y: double[1])
|
60
|
+
end
|
61
|
+
|
47
62
|
private
|
48
63
|
|
49
64
|
def initialize(poly)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: miami_dade_geo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryce Kerley
|
@@ -131,6 +131,8 @@ files:
|
|
131
131
|
- lib/miami_dade_geo.rb
|
132
132
|
- lib/miami_dade_geo/addr_xy_client.rb
|
133
133
|
- lib/miami_dade_geo/address.rb
|
134
|
+
- lib/miami_dade_geo/errors/base.rb
|
135
|
+
- lib/miami_dade_geo/errors/invalid_address_error.rb
|
134
136
|
- lib/miami_dade_geo/geo_attribute_client.rb
|
135
137
|
- lib/miami_dade_geo/get_closest_feature_client.rb
|
136
138
|
- lib/miami_dade_geo/latlong_client.rb
|