class MiamiDadeGeo::GetClosestFeatureClient
Singleton SOAP client for finding features close to a given point. Makes one SOAP request for WSDL on first instantiation.
@api private
Constants
- FIND_RADIUSES
- WSDL_URL
URL to GetClosestFeature service WSDL
Public Instance Methods
find_feature(xy_hash, feature_class)
click to toggle source
# 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)
click to toggle source
# 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
savon()
click to toggle source
Returns a Savon SOAP client instance
@return [Savon::Client]
# File lib/miami_dade_geo/get_closest_feature_client.rb, line 54 def savon @savon ||= Savon.client(wsdl: WSDL_URL) end