class SpatialFeatures::Importers::File
Public Class Methods
new(data, *args)
click to toggle source
# File lib/spatial_features/importers/file.rb, line 6 def initialize(data, *args) begin file = Download.open(data, unzip: [/\.kml$/, /\.shp$/], downcase: true) rescue Unzip::PathNotFound raise ImportError, "Archive did not contain a .kml or .shp file. Supported formats are KMZ, KML, and zipped ArcGIS shapefiles." end case ::File.extname(file.path.downcase) when '.kml' __setobj__(KMLFile.new(file, *args)) when '.shp' __setobj__(Shapefile.new(file, *args)) else raise ImportError, "Could not import file. Supported formats are KMZ, KML, and zipped ArcGIS shapefiles" end end