Class: SpatialFeatures::Importers::Shapefile
- Inherits:
-
Base
- Object
- Base
- SpatialFeatures::Importers::Shapefile
show all
- Defined in:
- lib/spatial_features/importers/shapefile.rb
Constant Summary
collapse
- FEATURE_TYPE_FOR_DIMENSION =
{ 0 => 'point', 1 => 'line', 2 => 'polygon' }.freeze
- PROJ4_4326 =
'+proj=longlat +datum=WGS84 +no_defs'.freeze
Instance Attribute Summary
Attributes inherited from Base
#errors, #source_identifier
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#features
Constructor Details
#initialize(data, proj4: nil, **options) ⇒ Shapefile
Returns a new instance of Shapefile.
12
13
14
15
|
# File 'lib/spatial_features/importers/shapefile.rb', line 12
def initialize(data, proj4: nil, **options)
super(data, **options)
@proj4 = proj4
end
|
Class Method Details
.create_all(data, **options) ⇒ Object
21
22
23
24
25
26
27
|
# File 'lib/spatial_features/importers/shapefile.rb', line 21
def self.create_all(data, **options)
Download.open_each(data, unzip: [/\.shp$/], downcase: true).map do |file|
new(file, **options)
end
rescue Unzip::PathNotFound
raise ImportError, INVALID_ARCHIVE
end
|
Instance Method Details
#cache_key ⇒ Object
17
18
19
|
# File 'lib/spatial_features/importers/shapefile.rb', line 17
def cache_key
@cache_key ||= Digest::MD5.file(archive).to_s
end
|