¦ ¦ ¦ ¦ ¦
ENVIS Technical Report 143,   May 2018
WASTE MANAGEMENT
Energy & Wetlands Research Group, Centre for Ecological Sciences, Indian Institute of Science, Bangalore, Karnataka, 560 012, India.
E Mail: tvr@iisc.ac.in; bharathh@iisc.ac.in; setturb@iisc.ac.in; svinay@iisc.ac.in Tel: 91-080-22933099, 2293 3503 extn 101, 107, 113
Working with GRASS

STEP 1) Creation of Folder: Create a working folder for Grass, Example: If you are working on a study area, Create a new folder named GRASS.

STEP 2) Start Grass: Use Grass version 7.0 and above.
STEP 3) Go to Select Directory, and select the folder you have created and Click on OK


STEP 4) Creating New Location:
Step i) Click on New under the Grass location tab, Enter Project location and Location title, Click on next


Step ii) Choose method of creating new location. This can be done using a) EPSG codes of spatial reference (one can search by datum’s or based on EPSG codes), b) Georeferenced files (Raster or Vector), c) Using Well Known Text file – (.prj files), d) Cartesian Co-ordinate system (use this if no information available or if the study area falls in 2 UTM zones, later while importing files, projections and datum’s can be over written using single or multiple files), e) Selection Projection and Coordinate system from the available list, f) Specifying Projection and Datum  using Custom parameters.








Note: One can Always Help  to open GRASS GIS Quickstart Guide
step iii) Lets continue by selecting “read projection and datum from a georeferenced file”
step iv) Browse and Select a file (Raster) to append the reference information from file to Location and click on open



Selected file (either raster or vector would be taken as reference), Click on next


step v) Projection and datum are defined for Location, Click on Finish



Step vi) New Location (New GIS data directory) is created, click on OK



step vii) Location and Permanent Mapset are created, Option is provided to import the reference data, Click on Yes or No accordingly.
Step vii) Regions settings are displayed, click set region. If the area of interest is smaller than the selected map, in region settings, values can be changed accordingly



Step 5) Creation of New Mapset: Since Permanent mapset contains all datum, projection and other information, it is recommended not to alter the Permanent mapset. Any manual alteration in permanent mapset may lead to data corruption of entire location.
For the first time when a new location is created, Option is provided to create a new mapset. Name the mapset and click on ok
For Subsequent creation of mapsets, click on New in “Select GRASS Mapset” tab, and create new mapsets accordingly


 


You can use New, Rename, Delete in Location and Mapset tabs for managing grass location and mapsets.
Step 6) Starting Grass Session: Select the Mapset you want to work with, and click on Start Grass Session which will open Layer Manager and Map display windows




 

Step 7: Various Tools


Step 8) Importing Data
Step i) Go to File, Import Raster, Common Format import. Input Raster Tab will be opened. You can use Source type as i) File for individual files, ii) Directory to import multiple files.

step ii) Select File, click on browse and select file format to be imported, Click on Open
 
Step iii) Rename the file as Path_Row_Band number Example 145_52_Band2 Click on Import. File is imported with new name, and displayed in Map display and layer manager


Similarly import rest of the bands
(preferably all of same resolution, Blue, Green, IR, NIR, SWIR bands)
Importing Raster as Directory: Go to File, Import Raster, Comman Raster formats. Click on Directory, Select Source type and Browse the Directory where the data is stored.



This will open all the raster files in the directory, select files to be imported and rename them



Step 9) Crop the image to eliminated background data
step i) Create a new Vector Map. Go to Vector, Create new Vector map, Enter name of Vector file click on ok



step ii) Select Vector layer, click on Vector editor



step iii) Select digitize new area,



Click on the image at corners leaving the edges/null data. To completer the polygon, right click, click on submit.



Click on Vector editor to save and stop editing, Output is as shown below



step iv) Convert Vector to Raster. Go to Vector, Map type conversions, Vector to Raster



Select input vector layer, define output name, source of raster values (category ‘cat’), then click on run to obtain the boundary raster


     


step v) cropping satellite data: to eliminate null values, Satellite data is extracted within the boundary of study using raster map calculator.
Go to Raster, raster map calculator to do numerical data operations. Use Boundary/mask layer and Raw satellite image by multiplication derive cropped maps 



In the expression window, use existing raster maps, raster operators to derive output maps. Provide output map name
Example: 145_52_Band2 * Bound = 145_52_B2_bound 



Step 11) Preparation of FCC
Step i) Auto balancing of colors: Go to Imagery, Manage image colors, Color balance



Step ii) Assign false colors i.e., Green to Blue, Red to Green and NIR to Red bands, select colors tab, click on extend colors to full range, then click on run



step iii) to prepare an FCC, go to Raster, Manage colors, Create RGB,



step iv) Assign Colors such Green to Blue, Red to Green and NIR to Red bands, provide output file name, example “145_52_FCC”, click on run


 

Step 12) Radiometric Correction
Since the FCC is not clear and if it shows high or low contrast, Check the histogram of individual satellite image, if the range is not to full scale, use raster rescale
Check Histogram: Open the image, go to
Rescale: Go to Raster, Change Category values and Labels, Rescale.



Select input image, define name for output image, Set color range (example landsat 8 is 16 bit data, color range is between 0 to 65535, similarly for other satellite images) Repeat same for all bands.


Once enhancement is complete, Follow Step 11 – Preparation of FCC
Step 13) Vegetation Indices (LAND COVER ANALYSIS)
Step i) Creation of Vegetation map: Vegetation indices (or any map operations are done using Map Calculator). Go to Raster Map Calculator.
Note: Since Vegetation indices are signed decimal numbers, we need to use “float” for calculation
Example: NDVI = float(float(NIR-R)/float(NIR + R))


 

Assign color i.e., represent vegetation  in shades of Green, Non Vegetation in shades of Yellow to Red i.e., use ryg color range for representing the data.
Go to Raster, Manage Colors, Color tables



Provide NDVI map as input map, Select Define Color, Choose color from color table “ryg



Click on Add Raster elements and add raster legend for NDVI



Step ii) Extraction of Statistical information: Overlay FCC, on NDVI. Select NDVI, zoom to sparse vegetation, use Query tool and click on pixels, select the lowest value as minimum for vegetation



To obtain statistical information, go to Raster, Reports and Statistics, Sum area by raster map and category



Select input NDVI map, select statistics and choose percent area and area in square kilometer or other units as necessary, then select No data, click on “do not report no data value and cells tabs”



NDVI output statistics are generated as text, copy the contents and paste in excel


 


Since the data is not organized, we need to split the data accordingly.
Select the column, go to Data tab and Select text to column. This will open a convert text to column wizard. In the wizard, select delimited. In the Delimited, Select Others and use “|” (Shift+ backslash), click on finish.





In the first row, type “Range, Area in sq.km (used units), %. Scroll down for the observed minimum value of NDVI for vegetation (example 0.139 – this value is close to 0.138998). all values below specified values fall under Non Vegetative category, others in Vegetation category



Results of NDVI: Non Vegetation (NDVI < 0.139) = 58.74%, 20044 sq.km, Vegetation (NDVI >0.139) = 41.19%, 14069 sq.km
Step 14) LAND USE ANALYSIS
Step i) Create of FCC
Step ii) Creation of image group and sub group: Go to imagery,  Develop images and groups, Create/edit group




Enter name of Group (Example:GRP), Click on Add, Select Bands to be added (Green, Red, NIR – better results with better number of spectral information) click on ok. This will load images that needs to be grouped in the data.


Select Edit/create subgroup, provide subgroup name, select bands in the order of Green to NIR. Click on Ok. Now Group and Subgroups are created.



One can check the Mapset folder, for the group and sub group folders after creation. Right Click on REF and open with Notepad ++ or word pad. This would show the list of bands selected to form a sub group. A Mapset can have any number of groups, and a group can have any number of subgroups



Step iii) Training Sites Creation: Create Vector files titled class names (Example: Water, Forest, Agriculture, Horticulture, Built up, Open area, Others, etc…)
Go to Vector, Develop Vector Map, Create New Vector map



Overly FCC, Start editing individual vector file
Example: Start editing water, start adding add polygon/lines on the water bodies, about 10 for the first try, similarly all other classes until classification is visually precise.
Once training sites are digitised, click on editor, save edits and stop editing. Make sure you take atleast 10 pixels per signature (generally N +1 where N is number of Bands)



Once all initial training datasites are completed, convert each training vectors to raster.
Provide input Vector (Example Vegetation) provide output raster name (Veg), Select Source of raster value as category.





step iv) Generation of Signatures: After the training sites are rasterised, Signatures are developed for classifying an image. To Generate Signatures, go to Imagery, select Classify image, then select Input for supervised MLC



Provide information such as input training file (raster), Group and Subgroup, Output signature name. Signatures are generated for each land use category separately.



After creating all signatures, go to the signature folder inside the subgroup folder created in the earlier steps.

 


Copy paste one of the Signature file, rename as “sig1”, Replace “# Category number”  with “#landuse_number# for individual signatures. Copy paste and rename each signature of different classes respectively. Make sure the editing’s are done using Notepad ++ or Wordpad. While adding second land use signature, copy entire body other than line one, and paste below the first set of land use signature in the “sig1” file. Follow the process for all land use signatures save the “sig1” signature file.



step v) Classification: Classification can be carried out in various ways, for the current analysis we would be using Maximum likelihood classifier algorithm. GO to imagery, Classify image, Maximum likelihood classification.



Provide input data such as Group name, Sub group, signature with respect to which classification would be done, provide output Classification file name (example: MLC1), click on run.


Reclassify the classified map to extract land use map. To do reclassification go to Raster, Change category values and lables, Reclassify

Provide input classified data (Example: MLC1), output as land use (RC_MLC1) and reclassification rules

Defining reclassification rules, right click on the classified output click on raster teport and statistics. Check the class number


Based on the category information available, reclassify the classified data to obtain Land use map by applying reclassification rules


Classified image (Signature)

Reclassification rules

# Water1 to # water 15

1 thru 15 = 1 Water                or
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 = 1 Water

#Urban 1 to # urban 8

16 thru 23 = 2 Urban

# Veg 1 to # Veg 10

17 thru 26 = 3 Veg

# Others 1 to # Others 12

27 thru 38 = 4 Others

After all signatures complete, Key as “ * = null” and next line “end”

The rules can be applied according to classification and land use classes present in signature. Apply reclass rules, run the program.

Land use map is developed as below. Since it has errors, collect additional signatures to achieve accurate map.


STEP 15) Classification Using Google Earth
Install Google earth to your Work System and Open Google Earth, navigate to your study area.
Right click on My places, Add, Folder and name it with land use class name (Example Water) and click on ok.


  


Click on Land Use Folder, Use Polygon feature tool, Name the polygon feature with class name and signature number Example Water 1, Water 2,…..



Digitize a training sites for the land use feature by clicking at various points within the feature, Click on Ok, Follow the same for multiple training sites and multiple land use classes. You can use Style/Colour to alter the properties of the polygon.


After Digitisation of all training data sites, right click on each land use folder and save as kml(Keyhole markup Language) file in a folder.



Import all these training sites into GRASS, as Vector: Go to File, Import Vector data, Common import formats



Since the kml files are in latitude longitude projection system, reprojection is necessary to match location projection. When you click on import, GRASS will automatically open reprojection tab. Import and reproject the kml files.



Training Data sites are overlaid on FCC and checked for errors, Edit erroneous data (training sites overlap of Multiple classes example Training sites of Vegetation may be overlaid on both Vegetation and Barren land on FCC; similarly, water training data on vegetation or other landscaps on FCC). Once Editing is completed, use these vector files to generate Signatures and Classify the satellite data into various land use classes.
STEP 16) ACCURACY ASSESSMENT
To check the accuracy of a classified output, reference data is necessary. Since we have carried out Land use classification, we will assume that Land use classification done through Google earth as reference data.
To Evaluate Accuracy, Go to Imagery, Reports and Statistics, Kappa Analysis



Provide Classified data information and reference data information,



Click on Run, Check the Command Output tab for Accuracy information. Click on Save to save the output information.



Note: Signatures should be taken optimally to avoid inaccuracies; the signatures should be well distributed and cover at least 15% of entire area. Taking pure signatures would help to achieve better precision.

 

 

 

E-mail     |     Sahyadri     |     ENVIS     |     GRASS     |     Energy     |     CES     |     CST     |     CiSTUP     |     IISc     |     E-mail