I am trying to download Modis NDVI and EVI images. I have used the following R-code:

    source("ModisDownload.R") ##ModisDownload.R is in the setwd directory#
    getMODIS(x=X, h=25, v=6, dates = c('2000.02.18', '2014.07.31'),  version='005')

I am getting the following error:

    Error in readChar(con, 5L, useBytes = TRUE) : cannot open the connection
    In addition: Warning message:
    In readChar(con, 5L, useBytes = TRUE) :
    cannot open compressed file 'ModisLP.RData', probable reason 'No such file or directory'

I am using Ubuntu 12.04. Please let me know me where I am going wrong.

  • Where does ModisDownload.r come from? Have you tried the r-package MODIS?
    – Curlew
    Aug 6, 2014 at 11:29
  • I have downloaded ModisDownload.R file from r-gis.net/?q=ModisDownload. I will check out MODIS package in R.
    – Karthik K
    Aug 6, 2014 at 12:16
  • 1
    I deleted ModisDownload.R and ModisLP.RData in my working directory and downloaded it again from r-gis.net/?q=ModisDownload. This time it worked. Thanks for response.
    – Karthik K
    Aug 6, 2014 at 12:37
  • I tested the procedure in Debian and it works well too. +1.
    – xunilk
    Apr 13, 2015 at 17:21
  • I could not download images with R because the USGS server is using http and ftp ModisDownload.R is, can you help me ?? Sep 26, 2016 at 15:40

2 Answers 2


Here is a quick workaround using the MODIS package:

# install.packages("MODIS")

MODISoptions(localArcPath = "/path/to/modis/files", 
             outDirPath = "/path/to/modis/files/processed")

runGdal("MOD13Q1", collection = "006", # see getCollection("MOD13Q1", forceCheck = TRUE)
        tileH = 25, tileV = 6, # MODIS tile id
        begin = "2000.02.18", end = "2000.03.31", # time period
        SDSstring = "110000000000") # SDS layers to extract (here: NDVI, EVI)

If you don't want to extract certain SDS layers, but deal with the raw .hdf files instead, simply use getHdf instead of runGdal and drop 'SDSstring'.


Have you tried using alternative software to download those images? For example, MODIS data can be accessed via LandViewer. All you need to do is locate an area of your interest and select MODIS imagery in the filter section. Once done you will have the option to download the data on the right.

An example of such imagery can be seen HERE or view this location on the platform directly HERE.

Here’s a brief guide to free satellite data that can be found on LandViewer:

  • Landsat 4 - archive 1982-1993
  • Landsat 5 - archive 1984-2013
  • Landsat 7 - archive since 1999
  • MODIS - archive since 2012
  • Landsat 8 - archive since 2013
  • Sentinel-1 - archive since 2014
  • Sentinel-2 - archive since 2015

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.