Module: GeoConcerns::Processors::BaseGeoProcessor

Extended by:
ActiveSupport::Concern
Included in:
Raster::Base, Vector::Base
Defined in:
app/processors/geo_concerns/processors/base_geo_processor.rb

Instance Method Summary collapse

Instance Method Details

#basenameString

Extracts the base file name (without extension) from the source file path.

Returns:

  • (String)

    base file name for source



70
71
72
# File 'app/processors/geo_concerns/processors/base_geo_processor.rb', line 70

def basename
  File.basename(source_path, File.extname(source_path))
end

#idString

Gets the fileset id or returns nil.

Returns:

  • (String)

    fileset id



76
77
78
# File 'app/processors/geo_concerns/processors/base_geo_processor.rb', line 76

def id
  directives.fetch(:id, nil)
end

#labelSting

Returns the label directive or an empty string.

Returns:

  • (Sting)

    output label



51
52
53
# File 'app/processors/geo_concerns/processors/base_geo_processor.rb', line 51

def label
  directives.fetch(:label, '')
end

#options_for(_format) ⇒ Object



39
40
41
42
43
44
45
46
47
# File 'app/processors/geo_concerns/processors/base_geo_processor.rb', line 39

def options_for(_format)
  {
    label: label,
    output_size: output_size,
    output_srid: output_srid,
    basename: basename,
    id: id
  }
end

#output_sizeString

Transforms the size directive into a GDAL size parameter.

Returns:

  • (String)

    derivative size



57
58
59
60
# File 'app/processors/geo_concerns/processors/base_geo_processor.rb', line 57

def output_size
  return unless directives[:size]
  directives[:size].tr('x', ' ')
end

#output_sridString

Gets srid for reprojection derivative or returns WGS 84.

Returns:

  • (String)

    spatial reference code



64
65
66
# File 'app/processors/geo_concerns/processors/base_geo_processor.rb', line 64

def output_srid
  directives.fetch(:srid, 'EPSG:4326')
end