[GRASS-user] First time GRASS user -- how to import an img dataset?

Hello. I need to learn how to use GIS and I have chosen to do it with GRASS. My plan is to learn GIS/GRASS essentials during the next 12 months and start applying it for my research the 12 months after that. I have started reading the documentation available and playing with the sample data set. However, I would also like to start playing with a dataset for Puerto Rico (PR) and I am having problems to import it. How would I go about importing a new dataset?

In particular, there is a landcover raster image in Erdas “img” format (prgap_landcover.img) that I would like to import from here:

ftp://ftp.gap.uidaho.edu/products/Puerto_Rico/GISdata/Landcover/1_Land_cover_grid/

(1) What do I do with this img file? Do I first copy and paste it to my GIS Data Directory? If not, how do I go about telling GRASS where this file is (if I want to import it)?

(2) I read about the commands to import raster Erdas/IMG files to GRASS (r.in.gdal -e in=<image.img> out=). If I want to use this command, should my img file be in the GIS Data Directory first as I suggested in (1)? Where do I type this command? The GRASS Command Line window seems to open for an existing Location.

(3) When do I create the location for my data? Do I do this before anything else?

(4) When trying to create a location from the Location Wizard, I chose as the method “Select coordinate system parameters from a list”. I did this because there is another file in the above mentioned ftp folder with several parameters which seem to me the kind of information that the wizard asks (see an excerpt below). From there I chose “lcc” as the projection code. However, from here onwards I start having problems. For instance, I don’t know whether to choose “Datum with associated ellipsoid” or “Ellipsoid only”. Also, the wizard asks me “Central Parallel”, “First Standard Parallel”, “Second Standard Parallel”, and I don’t know how that relates to the two “Standard_Parallel” parameters given below and where do I get the other “Parallel” parameter from? I seem to be missing one. For the geodetic datum I think I have to choose “nad83” and I think I will choose “No transformation” at the end of the wizard.

Any suggestions will be very welcome. Thank you in advance. Saludos, Julio.

Spatial_Reference_Information:
  Horizontal_Coordinate_System_Definition:
    Planar:
      Map_Projection:
        Map_Projection_Name: Lambert Conformal Conic
        Lambert_Conformal_Conic:
          Standard_Parallel: 18.033333
          Standard_Parallel: 18.433333
          Longitude_of_Central_Meridian: -66.433333
          Latitude_of_Projection_Origin: 17.833333
          False_Easting: 200000.000000
          False_Northing: 200000.000000
      Planar_Coordinate_Information:
        Planar_Coordinate_Encoding_Method: row and column
        Coordinate_Representation:
          Abscissa_Resolution: 15
          Ordinate_Resolution: 15
        Planar_Distance_Units: meters
    Geodetic_Model:
      Horizontal_Datum_Name: North American Datum of 1983
      Ellipsoid_Name: Geodetic Reference System 80
      Semi-major_Axis: 6378137.000000
      Denominator_of_Flattening_Ratio: 298.257222

Hello. I need to learn how to use GIS and I have chosen to do it with GRASS. My plan is to learn GIS/GRASS essentials during the next 12 months and start applying it for my

Welcome, and good decision.

research the 12 months after that. I have started reading the documentation available and playing with the sample data set. However, I would also like to start playing with a dataset for Puerto Rico (PR) and I am having problems to import it. How would I go about importing a new dataset?

In particular, there is a landcover raster image in Erdas “img” format (prgap_landcover.img) that I would like to import from here:

ftp://ftp.gap.uidaho.edu/products/Puerto_Rico/GISdata/Landcover/1_Land_cover_grid/

(1) What do I do with this img file? Do I first copy and paste it to my GIS Data Directory? If not, how do I go about telling GRASS where this file is (if I want to import it)?

If the file is somewhere on your computer, then just enter the path to it with the ‘input=’ parameter to r.in.gdal. Something like:
r.in.gdal in=/path/to/prgap_landcover.img out=prgap_landcover

(BTW, I think you can actually even import into GRASS straight from the URL…)

(2) I read about the commands to import raster Erdas/IMG files to GRASS (r.in.gdal -e in=<image.img> out=). If I want to use this command, should my img file be in the GIS Data Directory first as I suggested in (1)? Where do I type this command? The GRASS Command Line window seems to open for an existing Location.

(3) When do I create the location for my data? Do I do this before anything else?

YES, before anything else. This step is crucial, and sometimes confuses new users. You must have a correct LOCATION defined at the start such that it matches the CRS of the original data. GRASS always insists that all maps in a LOCATION are projected in exactly the same CRS.

From the metadata below it looks like this file is projected in the LCC projection matching the EPSG code of 2866. That’s NAD83(HARN) Puerto Rico and Virgin Islands.
You might try to first use the wizard to create a new location based on this EPSG code. That insures all the parameters get entered properly. Then, after starting GRASS in this location (also create a MAPSET - the GRASS way to keep maps filed in some directory which is logical for your work), try the r.in.gdal command.

(4) When trying to create a location from the Location Wizard, I chose as the method “Select coordinate system parameters from a list”. I did this because there is another file in the above mentioned ftp folder with several parameters which seem to me the kind of information that the wizard asks (see an excerpt below). From there I chose “lcc” as the projection code. However, from here onwards I start having problems. For instance, I don’t know whether to choose “Datum with associated ellipsoid” or “Ellipsoid only”. Also, the wizard asks me “Central Parallel”, “First Standard Parallel”, “Second Standard Parallel”, and I don’t know how that relates to the two “Standard_Parallel” parameters given below and where do I get the other “Parallel” parameter from? I seem to be missing one. For the geodetic datum I think I have to choose “nad83” and I think I will choose “No transformation” at the end of the wizard.

Any suggestions will be very welcome. Thank you in advance. Saludos, Julio.

Cheers. For future questions, let us know your OS and version of GRASS. And posting the output of commands like g.region -p, v.info, r.info will often help.

Regards,
Micha

···
-- 
Micha Silver
Arava Development Co. +972-52-3665918
[http://surfaces.co.il](http://surfaces.co.il)