services/importer/lib/importer/loader.rb
# Sometimes we could try to recover from a known failure
Sometimes we could try to recover from a known failure
Sometimes we could try to recover from a known failure
def try_fallback(append_mode)
        if ogr2ogr.invalid_dates?
          job.log 'Fallback: Autoguessing problem, trying to disable the problematic column'
          @job.fallback_executed = "date"
          ogr2ogr.overwrite = true
          ogr2ogr.csv_guessing = true
          ogr2ogr.quoted_fields_guessing = false
          disable_autoguessing_on_wrong_column(ogr2ogr.filepath, ogr2ogr.command_output)
          ogr2ogr.run(append_mode)
        elsif ogr2ogr.encoding_error?
          job.log "Fallback: There is an encoding problem, trying with ISO-8859-1"
          @job.fallback_executed = "encoding"
          ogr2ogr.overwrite = true
          ogr2ogr.encoding = "ISO-8859-1"
          ogr2ogr.run(append_mode)
        elsif ogr2ogr.missing_srs?
          job.log "Fallback: Source dataset has no coordinate system, forcing -s_srs 4326"
          @job.fallback_executed = "srs 4326"
          ogr2ogr.overwrite = true
          ogr2ogr.shape_coordinate_system = '4326'
          ogr2ogr.run(append_mode)
        end
        ogr2ogr.set_default_properties
      end
def try_fallback ( append_mode ) if ogr2ogr . invalid_dates? job . log 'Fallback: Autoguessing problem, trying to disable the problematic column' @job . fallback_executed = "date" ogr2ogr . overwrite = true ogr2ogr . csv_guessing = true ogr2ogr . quoted_fields_guessing = false disable_autoguessing_on_wrong_column ( ogr2ogr . filepath , ogr2ogr . command_output ) ogr2ogr . run ( append_mode ) elsif ogr2ogr . encoding_error? job . log "Fallback: There is an encoding problem, trying with ISO-8859-1" @job . fallback_executed = "encoding" ogr2ogr . overwrite = true ogr2ogr . encoding = "ISO-8859-1" ogr2ogr . run ( append_mode ) elsif ogr2ogr . missing_srs? job . log "Fallback: Source dataset has no coordinate system, forcing -s_srs 4326" @job . fallback_executed = "srs 4326" ogr2ogr . overwrite = true ogr2ogr . shape_coordinate_system = '4326' ogr2ogr . run ( append_mode ) end ogr2ogr . set_default_properties end
Sometimes we could try to recover from a known failure
Sometimes we could try to recover from a known failure
append_mode
<not_specific>