Проблема с кодом для загрузки изображений с несколькими URL-адресами с использованием R - PullRequest
0 голосов
/ 07 мая 2020

Я начинаю практиковать R, у меня есть следующий код для выполнения многократной загрузки спутниковых изображений, но по какой-то причине изображения теряют право собственности на изображения

setwd("C:/DigitalGlobe") # where you want to save the image archive

urls <- c(
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/CS_San_Jose_19Q2_V0_BROWSE.tif",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/CS_San_Jose_19Q2_V0_BROWSE.tif.md5sum",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/CS_San_Jose_19Q2_V0_R1C1.tif",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/CS_San_Jose_19Q2_V0_R1C1.tif.md5sum",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/CS_San_Jose_19Q2_V0_R1C2.tif",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/CS_San_Jose_19Q2_V0_R1C2.tif.md5sum",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/CS_San_Jose_19Q2_V0_R1C3.tif",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/CS_San_Jose_19Q2_V0_R1C3.tif.md5sum",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/CS_San_Jose_19Q2_V0_R1C4.tif",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/CS_San_Jose_19Q2_V0_R1C4.tif.md5sum",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/CS_San_Jose_19Q2_V0_R1C5.tif",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/CS_San_Jose_19Q2_V0_R1C5.tif.md5sum",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/CS_San_Jose_19Q2_V0_R2C1.tif",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/CS_San_Jose_19Q2_V0_R2C1.tif.md5sum",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/CS_San_Jose_19Q2_V0_R2C2.tif",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/CS_San_Jose_19Q2_V0_R2C2.tif.md5sum",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/CS_San_Jose_19Q2_V0_R2C3.tif",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/CS_San_Jose_19Q2_V0_R2C3.tif.md5sum",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/CS_San_Jose_19Q2_V0_R2C4.tif",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/CS_San_Jose_19Q2_V0_R2C4.tif.md5sum",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/CS_San_Jose_19Q2_V0_R2C5.tif",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/CS_San_Jose_19Q2_V0_R2C5.tif.md5sum",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/CS_San_Jose_19Q2_V0_R3C1.tif",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/CS_San_Jose_19Q2_V0_R3C1.tif.md5sum",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/CS_San_Jose_19Q2_V0_R3C2.tif",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/CS_San_Jose_19Q2_V0_R3C2.tif.md5sum",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/CS_San_Jose_19Q2_V0_R3C3.tif",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/CS_San_Jose_19Q2_V0_R3C3.tif.md5sum",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/CS_San_Jose_19Q2_V0_R3C4.tif",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/CS_San_Jose_19Q2_V0_R3C4.tif.md5sum",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/CS_San_Jose_19Q2_V0_R3C5.tif",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/CS_San_Jose_19Q2_V0_R3C5.tif.md5sum",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/archive_recovery.log",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/catalog_recovery.log",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/metadata_CS_San_Jose_19Q2_V0.dbf",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/metadata_CS_San_Jose_19Q2_V0.dbf.md5sum",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/metadata_CS_San_Jose_19Q2_V0.prj",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/metadata_CS_San_Jose_19Q2_V0.prj.md5sum",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/metadata_CS_San_Jose_19Q2_V0.shp",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/metadata_CS_San_Jose_19Q2_V0.shp.md5sum",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/metadata_CS_San_Jose_19Q2_V0.shx",
  "https://opendata.digitalglobe.com/events/covid19/metro-basemaps/2019-4-17/San_Jose_CS/metadata_CS_San_Jose_19Q2_V0.shx.md5sum"
)

for (url in urls) {
  newName <- basename(url)
  download.file(url, destfile = newName)
}

Если они загружаются каждое отдельно (обычная загрузка) они сохраняют свои свойства

введите здесь описание изображения

Но если они загружаются с кодом R, они теряют свои свойства и их невозможно открыть

введите описание изображения здесь

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...