Class: SpatialFeatures::Importers::KMLFile

Inherits:
KML
  • Object
show all
Defined in:
lib/spatial_features/importers/kml_file.rb

Direct Known Subclasses

Geomark, KMLFileArcGIS

Instance Attribute Summary

Attributes inherited from Base

#errors

Instance Method Summary collapse

Methods inherited from Base

#cache_key, create_all, #features

Constructor Details

#initialize(path_or_url, *args) ⇒ KMLFile

Returns a new instance of KMLFile.



4
5
6
7
8
9
10
# File 'lib/spatial_features/importers/kml_file.rb', line 4

def initialize(path_or_url, *args)
  super Download.read(path_or_url, unzip: '.kml'), *args

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