Class: SpatialFeatures::Importers::KMLFile
- Defined in:
- lib/spatial_features/importers/kml_file.rb
Direct Known Subclasses
Constant Summary
Constants inherited from KML
SpatialFeatures::Importers::KML::COORDINATES_WITH_ALTITUDE, SpatialFeatures::Importers::KML::IMAGE_METADATA_KEYS
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #cache_key ⇒ Object
-
#initialize(path_or_url, **options) ⇒ KMLFile
constructor
A new instance of KMLFile.
Methods inherited from Base
Constructor Details
#initialize(path_or_url, **options) ⇒ 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, **) path = Download.open_each(path_or_url, unzip: [/\.kml$/], downcase: true).first super ::File.read(path), base_dir: Pathname.new(path).dirname, ** 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 |
Instance Method Details
#cache_key ⇒ Object
12 13 14 |
# File 'lib/spatial_features/importers/kml_file.rb', line 12 def cache_key @cache_key ||= Digest::MD5.hexdigest(@data) end |