Class: MiamiDadeGeo::GetClosestFeatureClient Private

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/miami_dade_geo/get_closest_feature_client.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Singleton SOAP client for finding features close to a given point. Makes one SOAP request for WSDL on first instantiation.

Constant Summary collapse

WSDL_URL =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

URL to GetClosestFeature service WSDL

"http://gisws.miamidade.gov/gisxyservices/GetClosestFeature.asmx?wsdl"
FIND_RADIUSES =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

[0, 10, 100, 1000, 5280, (20 * 5280)]

Instance Method Summary collapse

Instance Method Details

#find_feature(xy_hash, feature_class) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/miami_dade_geo/get_closest_feature_client.rb', line 18

def find_feature(xy_hash, feature_class)
  FIND_RADIUSES.each do |radius|
    result = get_closest_feature(feature_class,
                                 xy_hash[:x].to_s,
                                 xy_hash[:y].to_s,
                                 radius.to_s)

    return result unless result.nil?
  end

  nil
end

#get_closest_feature(feature_class, x, y, buffer) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/miami_dade_geo/get_closest_feature_client.rb', line 31

def get_closest_feature(feature_class, x, y, buffer)
  body = savon.
         call(:get_closest_feature_from_xy_all_atrbts,
              message: {
                'X' => x,
                'Y' => y,
                'Buffer' => buffer,
                'NameOfFeatureClass' => feature_class
              }).
         body

  begin
    resp = body[:get_closest_feature_from_xy_all_atrbts_response]
    rslt = resp[:get_closest_feature_from_xy_all_atrbts_result]
    poly = rslt[:diffgram][:document_element][:results]
  rescue
    nil
  end
end

#savonSavon::Client

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a Savon SOAP client instance

Returns:

  • (Savon::Client)


54
55
56
# File 'lib/miami_dade_geo/get_closest_feature_client.rb', line 54

def savon
  @savon ||= Savon.client(wsdl: WSDL_URL)
end