Installing OSGeo4w

The preferred source for  gdal  on windows is OSGeo4w. FWTools is no longer being kept current with updates to gdal so I suggest that you install OSGeo4w. I believe that FWTools is built on gdal 1.7 and OSGeo4w ( at this time ) is up to gdal 1.9.2. So, we use OSGeo4w to stay current with gdal.

First, familarize yourself with gdal. The web page is here.  Gdal is a open source data translation tool. In order to work with MODIS data you need a mechanism for getting it out of  “hdf” or hdf eos” format into a format that can be used by R’s  GIS packages. So, for example, if you want to use “raster”  you need to transform the “hdf” formated data into something readable by raster like “geotiff”.  gdal is the tool used to do that.

Gdal comes with various utilities, listed here: so, utilities like gdal_transform and gdal_warp can be used to transform and reproject data prior to importing it into R.  Of course, some of these tools are available within R ( using rgdal, sp, raster), but for MODIS R, and big jobs, you probably want to use the gdal tool as an external program. Basically, as long as you are reading in a “hdf” file using gdal, you should apply whatever other processing you want to do at that point. More specifically, “rgdal” does not have the ability to read  “hdf”, so you have to use the external version of gdal to do this. I hope that makes sense. MODIS comes in “hdf” format. To read that format and output geotiff you can use MRT or Gdal. MRT will allow you to mosaic tiles, resample, reproject, and output. That output is then readable by “raster”.  Gdal has more capabilities than MRT and also outputs geotiff. So, you have two paths for getting data into R friendly formats: MRT and gdal.  Both MRT and gdal can be used manually ( as shown in the MRT example and the FWTools example ) OR you can write scripts to execute bigger jobs.  The purpose of MODIS R,  is to allow you to write these “scripts” or “jobs” in an R environment. So in the end we will use MODIS R to make calls, like runGdal(). those calls will invoke the external tool.  To recap you can:

1. Use MRT or gdal manually to transform “hdf” into R friendly formats.

2. you can write “scripts” to control MRT or gdal.

3. You can use MODIS R to make “calls” that execute the external tools.

Now, go here to get OSGeo4W.

OSGeo4W is basically an installer that installs a variety of open source GIS tools like GRASS, QGIS and also gdal.  You get the installer at this location

Download the installer. Select express install. Unless you are interested in GRASS or QGis or the other tools, just deselect them and only install GDAL/OGR.

The install will happen at the root, so on my machince I end up with SGeo4w installed at C://Osgeo4w. It will be important to remember where you installed it. MOST IMPORTANT is the fact that the gdal libraries are in the “bin” directory, so C://OSGeo4w/bin  will be your likely path to gdal. The “pathGDAL” variable is one you are going to have to set when you use MODIS R, because MODIS R is going to make “calls” to gdal.

If you are a beginner in R you are probably not familar with the system call:  system(). MODIS R, uses system() to make calls that the windows OS will then pass to gdal or MRT. That is how we execute gdal and MRT from within R. We make system() calls. For those calls to work either your windows path has to “know” where the tool is ( MRT works this way, since it sets a HOME_DIR) or in the case of gdal we tell the system call where the tool is located.

After you have OSGeo4W installed, please check that you know where it installed and have a look inside the “bin” directory for gdal.

Mine looks like this

Next Page is

  1. Ricardo Kleiner
    August 9, 2013 at 9:23 PM

    I had a problem: when I try to instal de aplication (OSgeo4W setup) the interface ask me a user and passowrd! Is it free?

  2. Bryne
    August 29, 2013 at 12:06 AM

    I also had an issue. A message saying “access denied” came up when I tried to install it. I had to install the older version of rgdal instead.

    • Bryne
      August 29, 2013 at 12:50 AM

      Issue resolved! Just had to download the 64 bit installer for Windows

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 36 other followers

%d bloggers like this: