class SpatialFeatures::Importers::KMLFileArcGIS

Public Class Methods

new(data, *args) click to toggle source
# File lib/spatial_features/importers/kml_file_arcgis.rb, line 6
def initialize(data, *args)
  super

rescue SocketError, Errno::ECONNREFUSED
  url = URI(data)
  raise ImportError, "ArcGIS Server is not responding. Ensure ArcGIS Server is running and accessible at #{[url.scheme, "//#{url.host}", url.port].select(&:present?).join(':')}."
rescue OpenURI::HTTPError
  raise ImportError, "ArcGIS Map Service not found. Ensure ArcGIS Server is running and accessible at #{path_or_url}."
end

Private Instance Methods

each_record() { |record| ... } click to toggle source

ArcGIS includes metadata as an html table in the description

# File lib/spatial_features/importers/kml_file_arcgis.rb, line 19
def each_record(&block)
  super do |record|
    record.metadata = Hash[Nokogiri::XML(record.metadata[:description]).css('td').collect(&:text).each_slice(2).to_a]
    yield record
  end
end