Class: Geoloader::Loaders::ShapefileGeoserver

Inherits:
Loader
  • Object
show all
Defined in:
lib/geoloader/loaders/shapefile_geoserver.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Loader

load_or_enqueue, perform

Constructor Details

#initialize(*args) ⇒ ShapefileGeoserver

Configure the asset, connect to Geoserver.



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/geoloader/loaders/shapefile_geoserver.rb', line 14

def initialize(*args)

  super

  # Create and configure the asset.
  @shapefile = Geoloader::Assets::Asset.new(@file_path, @workspace, @desc_path)
  @shapefile.extend(Geoloader::Assets::Shapefile)

  # Connect to Geoserver, create the workspace.
  @geoserver = Geoloader::Services::Geoserver.new
  @geoserver.ensure_workspace(@workspace)

end

Instance Attribute Details

#geoserverObject (readonly)

Returns the value of attribute geoserver.



7
8
9
# File 'lib/geoloader/loaders/shapefile_geoserver.rb', line 7

def geoserver
  @geoserver
end

#shapefileObject (readonly)

Returns the value of attribute shapefile.



7
8
9
# File 'lib/geoloader/loaders/shapefile_geoserver.rb', line 7

def shapefile
  @shapefile
end

Instance Method Details

#loadObject

Push a Shapefile to Geoserver.



31
32
33
34
35
# File 'lib/geoloader/loaders/shapefile_geoserver.rb', line 31

def load
  @shapefile.stage do
    @geoserver.create_datastore(@shapefile)
  end
end