Class: SpatialFeatures::Importers::File

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/spatial_features/importers/file.rb

Instance Method Summary collapse

Constructor Details

#initialize(data, *args) ⇒ File

Returns a new instance of File.



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/spatial_features/importers/file.rb', line 6

def initialize(data, *args)
  file = Download.open(data, unzip: %w(.kml .shp))

  if file.path.end_with? '.kml'
    __setobj__(KMLFile.new(file, *args))

  elsif file.path.end_with? '.shp'
    __setobj__(Shapefile.new(file, *args))

  else
    raise ImportError, "Could not import file. Supported formats are KMZ, KML, and zipped ArcGIS shapefiles"
  end
end