1
0
Fork 0
terragear/src/Lib/landcover
david d2b2afc33d Cleaned up errors and warnings, mostly namespace problems with cout
and cerr, but also some SimGear linking problems.
2002-01-30 13:52:37 +00:00
..
.cvsignore Ignore files for autogenerated files. 2001-12-30 02:16:03 +00:00
landcover.cxx Various Irix fixes. Thanks Erik! 2001-07-31 20:14:54 +00:00
landcover.hxx Cleaned up errors and warnings, mostly namespace problems with cout 2002-01-30 13:52:37 +00:00
Makefile.am Initial revision. 2000-11-08 15:28:46 +00:00
README Initial revision. 2000-11-08 15:28:46 +00:00
test-landcover.cxx Various Irix fixes. Thanks Erik! 2001-07-31 20:14:54 +00:00

LandCover - a library for reading the USGS 30 arcsec land-cover image.

Files:

  README - this file
  Makefile - Unix Makefile for the project
  landcover.hxx - LandCover class declarations
  landcover.cxx - LandCover class implementation
  test-landcover.cxx - simple test program

At the time of writing, the USGS worldwide 30 arc-second land-cover
image is available for free download at

 http://edcwww.cr.usgs.gov/pub/data/glcc/globe/latlon/gusgs2_0ll.img.gz

The legend for the image is available at

 http://edcwww.cr.usgs.gov/pub/data/glcc/globe/latlon/usgs2_0.leg

This image contains land-cover data for the entire world in 30
arc-second increments (about a square kilometer, depending on
latitude).  The class allows you to provide geographical co-ordinates
and discover the predominant land cover for that location.  This class
is intended for integration into the TerraGear terrain construction
program for the FlightGear flight simulator (see www.terragear.org and
www.flightgear.org).

The image uncompresses to nearly a gigabyte, so this class does not
attempt to hold the entire image in memory; instead, it opens a stream
to the file and seeks to the appropriate position for each query.  The
stream is closed automatically by the destructor.

The image file is 43200 bytes wide and 21600 bytes high, and each byte
represents the land cover of a square 30 arc second area from
longitude -180.0 to 180.0 horizontally and from latitude 90.0 to -90.0
vertically.

To retrieve a value at any location, there are two getValue methods:

 int getValue (long x, long y)
 int getValue (double lon, double lat)

The first method returns the value at a location using native image
coordinates, where 0,0 is the top left corner and 43200,21600 is the
bottom right corner.  The second method returns the value at a
location using longitude and latitude, where -180.0,90.0 is the top
left corner and 180.0,-90.0 is the bottom right corner.

This class should work with any image file using the same coordinate
system and resolution.  For the USGS image, you can look up the legend
associated with any land-cover value using the getDescUSGS method.

The test program has the following usage:

  test-landcover <image-file> <longitude> <latitude>

For example, to check the land cover for longitude 75W latitude 45N,
you would use
 
  test-landcover gusgs2_0ll.img -75.0 45.0


--
David Megginson, david@megginson.com
2000-10-25