# frozen_string_literal: true class Map::Gdal::GridService include Map::Gdal::Base def initialize(kml) @kml = kml store_kml end def call(options = {}) raise 'Invalid field' unless options[:field] out = get_path_to_temp_file('out', 'kml') where = options[:where] ? "-where \"#{options[:where]}\"" : '' algorithm = options[:algorithm] ? "-a #{options[:algorithm]}" : '' run_command( %{ gdal_grid -q #{algorithm} #{where} -zfield "#{options[:field]}" -of GTiff -ot Float64 -l "#{get_layer_name}" #{@file} #{out} }.squish ) add_to_clean(out) out end end