Example: Import CTG Grid Cell File and Style

In this example we import a CTG LULC Grid Cell file containing raster data showing land use and land cover and then we use Style to provide a more understandable display.  See also the companion Example: Import GIRAS vector LULC File and Style topic and also the Example: Trace Vector Areas from Raster Pixels , which uses the CTG files imported here in an example of  the Transform panel's  Trace Areas template.  Download the project used in this example from the Downloads page.

 

LULC (Land Use Land Cover) data for locations in the United States has been provided by the USGS (U.S. Geological Survey) over the years using several different formats.   Legacy LULC data sets are often found that use two different formats for LULC data for the same region: the GIRAS (Geographical Information Retrieval and Analysis System) vector format, and  CTG (Composite Theme Grid) raster format.

CTG LULC Files

Files in either CTG or GIRAS format do not use three-letter extensions.  For example, downloading and then decompressing any compressed files for the San Francisco 100K LULC data set from USGS will result in five files, as seen in Windows File Explorer:

 

lulc_giras_and_ctg_files_01.png  

One of the files, the grid_cell file, is raster data in CTG format.   The other four files contain vector data in GIRAS format.   

 

It is not always easy to remember that the grid_cell file uses a different format, so Manifold users will rename the grid_cell file to grid_cell.ctg to indicate it is a raster file in CTG format, a different format used than the other four files.  

 

lulc_giras_and_ctg_files_02.png

The grid_cell.ctg file can then be imported into Manifold using the CTG dataport.

 

dlg_import_ctg_lulc.png

 

To import from LULC CTG format:

 

  1. Choose File-Import from the main menu.

  2. In the Import dialog browse to the location of the file.

  3. Chose the . Files (CTG LULC) (*.*) option.

  4. Double-click on the the grid_cell file or grid_cell.ctg file.

  5. A table and four images will be created.

 

il_import_ctg_lulc01_01.png

The four images each use a different tile column in the grid_cell Tiles table.

 

il_import_ctg_lulc01_02.png

 

Double-clicking open the grid_cell Tiles table we can see the four different tile fields used by the images.

 

il_import_ctg_lulc01_03.png

 

We can double-click one of the images open to view it.   For a more interesting display, we first create a new data source using a Bing street maps imageserver as shown in the Example: An Imageserver Tutorial topic,  we create a map and drag and drop the Bing layer into the map, and then we drag and drop the grid_cell LULC image into the map.

 

CTG format stores projection information so the image has been imported with the correct coordinate system.  It appears in the right place, showing the parts of the San Francisco Bay region and neatly aligned with the background Bing map.  However, the image needs to be styled to provide useful colors.   To do that we click on the grid_cell LULC image layer to make sure it is the active layer and then we launch the Style panel.

 

il_import_ctg_lulc01_04a.png

 

The default interpretation of the CTG raster has the same Channel 0 mapped to R, G and B display outputs.   We will change that to using a single channel driving a palette by changing the (use RGBA channels) choice to the Channel 0 choice as seen below.

 

il_import_ctg_lulc01_04b.png

 

We change the number of Values to 100, choose unique values as the method and we press the Tally button to load up the palette pane with all of the different unique pixel values in the image.    By default, black is used for all palette values.

 

il_import_ctg_lulc01_04.png

 

In the Style panel we check the Common color channel box and then choose unique values as the Method to use.   We press palette button and choose the Land Cover palette to load that palette into the color wells.   Press Update Style.   No need to close the Style panel, as we will be using it in the steps ahead and it remains alive as we move back and forth between the panel and the map.

 

il_import_ctg_lulc01_05.png

 

That applies the Land Cover palette to the different pixel values in the image.   That is better than black tones, but we can improve the display by adapting the default palette with a few changes in the Style panel.

 

il_import_ctg_lulc01_06.png

Back in the Style panel we click into any of the palette rows to move the focus into the list of palette values.    We then Ctrl-A to select all rows.   Next, we right-click onto any of the color wells  and choose Reverse from the context menu.   

 

il_import_ctg_lulc01_07.png

 

That reverses the order in which the palette is applied to the unique pixel values in the palette pane.    We press Update Style to see how that looks in the map.

 

il_import_ctg_lulc01_08.png

 

Even better.  Now the portions of the image that we know are forested regions are green, and those portions that correspond to city regions are not green.   Next, we will eliminate the wrong colors that are used for ocean and bay regions.   We think blue would be a better color to represent water regions.

 

il_import_ctg_lulc01_09.png

 

From the classification table given in the Notes below (documentation easily found online at various USGS sites) we know that pixels with a value of 54 represent bays or lakes.  We double-click into the green color well for that pixel value and we change the color to light blue.  Press Update Style.  

 

il_import_ctg_lulc01_10.png

 

Near the top of the palette pane we likewise change the color for pixel values of 0 to light blue as well. From the table in the Notes section below we know that 0 is a code for water as well.   We press Update Style to see how that looks in the map.

 

il_import_ctg_lulc01_11.png

 

Much better.   We now have a clear display of land use and land cover in the Bay area.   The ocean and bay regions are blue as well.    If we were interested in a particular set of pixels for land use, we could consult the table in the Notes to find a category of interest and color those pixel values a contrasting color, such as bright red, to see where they are.

 

As interesting as the above display may be, if we do not intend to use the land use image on its own but want to keep displaying it in a map using Bing as a background, we may as well use the color of water regions displayed by Bing.    The easiest way to do that is to double-click into the color wells for the pixel values that represent water and to change the color to transparent color, represented with a hatch pattern.

 

il_import_ctg_lulc01_12.png

 

We do that first for the 54 pixel value.

 

il_import_ctg_lulc01_13.png

 

We then change the color for pixel values of 0 to transparent color as well.   We press Update Style. .

 

il_import_ctg_lulc01_14.png

 

In the map we see that all pixels colored in transparent color have disappeared.   The Bing background now shows through in water regions of the image.

 

il_import_ctg_lulc01_15.png

If we like, we can easily add other layers from other imageservers like seen in the Example: Spectacular Images and Data from Web Servers  topic.  In the map above we have added a Google satellite imageserver layer below the grid_cell LULC layer, and above the image layer we have added a Google layer that provides streets and labels with transparent background.

 

The image seen above is the same map published in larger size on the Data Sources page on the Manifold website.   Especially in the larger view we can see how the land use raster image aligns very well with the satellite imagery.

 

Notes

Classification Codes - The value for each pixel in the grid_cell LULC image is a classification code that can be matched to a palette color to provide a more understandable display, as illustrated above.  The Example: Trace Vector Areas from Raster Pixels  topic shows how to use a simple query to add classification codes to a results table of areas created by the Trace Areas transform template from the grid_cell LULC image.

 

USGS defines the following codes:

 

1 Urban or Built-Up Land

11 Residential

12 Commercial Services

13 Industrial

14 Transportation, Communications

15 Industrial and Commercial

16 Mixed Urban or Built-Up Land

17 Other Urban or Built-Up Land

 

2 Agricultural Land

21 Cropland and Pasture

22 Orchards, Groves, Vineyards, Nurseries

23 Confined Feeding Operations

24 Other Agricultural Land

 

3 Rangeland

31 Herbaceous Rangeland

32 Shrub and Brush Rangeland

33 Mixed Rangeland

 

4 Forest Land

41 Deciduous Forest Land

42 Evergreen Forest Land

43 Mixed Forest Land

 

5 Water

51 Streams and Canals

52 Lakes

53 Reservoirs

54 Bays and Estuaries

 

6 Wetland

61 Forested Wetlands

62 Non-forested Wetlands

 

7 Barren Land

71 Dry Salt Flats

72 Beaches

73 Sandy Areas Other than Beaches

74 Bare Exposed Rock

75 Strip Mines, Quarries, and Gravel Pits

76 Transitional Areas

77 Mixed Barren Land

 

8 Tundra

81 Shrub and Brush Tundra

82 Herbaceous Tundra

83 Bare Ground

84 Wet Tundra

85 Mixed Tundra

 

9 Perennial Snow and Ice

91 Perennial Snowfields

92 Glaciers

 

Oceans may be coded with a value of 2000000102 or 0.

 

See Also

Style: Images

 

CTG, LULC Grid Cell

 

GIRAS, LULC Vector Format

 

Example: Spectacular Images and Data from Web Servers

 

Example: An Imageserver Tutorial

 

Example: Import GIRAS vector LULC File and Style

 

Example: Trace Vector Areas from Raster Pixels - This example follows the Trace Vector Areas from Raster Pixels video on the Gallery page.   We use the Trace Areas template in the Transform panel for images to create a drawing with vector areas covering regions of similarly-colored pixels.  Next, we use a simple query to add classification codes from a USGS table of classes to the resulting drawing, using a simple INNER JOIN SQL statement.