Sha256: a4901a10ea9e2d2eca05c122aac785b510d8d88095fd80000912ed7c09a0eb75

Contents?: true

Size: 539 Bytes

Versions: 12

Compression:

Stored size: 539 Bytes

Contents

require 'open-uri'

module SpatialFeatures
  module Importers
    class File < SimpleDelegator
      def initialize(data, *args)
        file = Download.open(data, unzip: %w(.kml .shp))

        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
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
spatial_features-2.7.6 lib/spatial_features/importers/file.rb
spatial_features-2.7.5 lib/spatial_features/importers/file.rb
spatial_features-2.7.4 lib/spatial_features/importers/file.rb
spatial_features-2.7.2 lib/spatial_features/importers/file.rb
spatial_features-2.7.1 lib/spatial_features/importers/file.rb
spatial_features-2.7.0 lib/spatial_features/importers/file.rb
spatial_features-2.6.4 lib/spatial_features/importers/file.rb
spatial_features-2.6.3 lib/spatial_features/importers/file.rb
spatial_features-2.6.2 lib/spatial_features/importers/file.rb
spatial_features-2.6.1 lib/spatial_features/importers/file.rb
spatial_features-2.6.0 lib/spatial_features/importers/file.rb
spatial_features-2.5.3 lib/spatial_features/importers/file.rb