CGGEOMAP
The purpose of this function is to translate a GEOTIFF structure
(as returned by QUERY_TIFF or READ_TIFF) into a map coordinate
object (cgMap) that can be used to georeference images with a
map data coordinate system. The Coyote Library is required.
It is not possible to have a one-to-one mapping between every GeoTIFF file and a map projection
in IDL, since IDL has a limited number of map projections and datums available. And, even at that,
I have not implemented all of IDL's map projections or datums, only those that I thought were most
likely to be encountered in my own work. If you run into a GeoTIFF file that does not work in this
code (either because of an error in the code or because it is not supported), please contact me.
I am interested in supporting as many GeoTIFF files as possible and I will take pains to do so if
I know they are needed.
Categories
Graphics, Map Projections
Returns
A cgMap coordinate object is returned containing the map projection information
for the image.
Params
image: in, optional, type=various
A GeoTIFF image. This can optionally be the name of a GeoTiff file.
If a filename is used, do not pass the geoTiff parameter, as this
parameter will be obtained from the GeoTiff file.
geotiff: in, optional, type=structure
A GeoTIFF structure of geoTags. Normally obtained by calling
QUERY_TIFF or READ_TIFF, but will be read from the file if a
filename is passed as the first positional parameter. It the geotag
is read from the file, it can be passed back to the user by setting
this parameter to a named variable.
Keywords
ccolor: in, optional, type=string, default='Charcoal'
The name of a color the map continents should be displayed with. The default
is "charcoal". Color names are those supported by cgColor.
clip: in, optional, type=boolean, default=0
Set this keyword to display the image (assumes the `Display` keyword is set)
with a two-precent histogram clipping.
continents: in, optional, type=boolean, default=0
If a cgMap object is made successfully, then setting this keyword
will add a cgMapContinents object to the cgMap object.
display: in, optional, type=boolean, default=0
Set this keyword to display the image with the map annotations in a
resizeable cgWindow.
gcolor: in, optional, type=string, default='Gray'
The name of a color the map grid should be displayed with. The default
is "gray". Color names are those supported by cgColor.
grid: in, optional, type=boolean, default=0
If a cgMap object is made successfully, then setting this keyword
will add a cgMapGrid object to the cgMap object.
image: out, optional, type=varies
Set this keyword to a named variable that on exit will contain the image data.
mcolor: in, optional, type=string, default='Black'
The name of a color the map should be displayed in. (Normally the map
border and map title are displayed in this color.)
onimage: in, optional, type=boolean, default=0
Set this keword if the map object is to get its position from the last
cgImage command issued.
silent: in, optional, type=boolean, default=0
IDL cannot map every GeoTiff image to a supported map projection or datum.
Normally, if the GeoTIFF image is unsupported, an error message is issued.
Setting this keyword will suppress such error messages. If you do this, you
MUST check the SUCCESS keyword to see if the program ran successfully. (Of
course, it is a good idea to check it in any case!)
sub_rect: in, optional, type=integer
Set this keyword to a four-element array, [x, y, width, height], that
specifies a rectangular region within the file to extract. Only the
rectangular portion of the image selected by this keyword is read and
returned. The rectangle is measured in pixels from the lower left
corner (right hand coordinate system). If this keyword is not use, the
entire image is read.
success: out, optional, type=boolean, default=0
An output variable that will contain a 1 if the map coordinate object was
created successfully. Or to a 0 if it was not created successfully.
title: in, optional, type=string, default=""
The title of the map projection.
_extra: in, optional
Any keyword appropriate for cgImage can be collected and passed along if
the DISPLAY keyword is also set.
Examples
To display a GeoTiff image in cgWindow with map annotations::
file = 'C:\IDL\data\tiff\AF03sep15b.n16-VIg.tif'
mapCoord = cgGeoMap(file, /Continents, /Grid, /Display)
Author
FANNING SOFTWARE CONSULTING::
David W. Fanning
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
History
Modification History
Converted from old GeoTIff program in Catalyst Library to run with Coyote Graphics routines.
9 November 2011. David W. Fanning.
Assuming meters as unit length if can't find linear measure in file. 1 Dec 2011. DWF.
Added UTM Zone 18S (projection 29178) for LandSAT MSS images over Amazon. 1 Dec 2011. DWF.
Added the ability to pass cgImage keywords via the keyword inheritance mechanism. 1 Dec 2011. DWF.
Added SUB_RECT keyword. 5 Dec 2011. DWF.
Added ability to read GOES EAST and GOES WEST GeoTiff files from this NOAA web site:
http://http://www.osdpd.noaa.gov/ml/gis/index.html. 26 Dec 2011. DWF.
Modified code to read GeoTiff files created by HEG v2.11 from HDF-EOS2 grid files. 30 Dec 2011. DWF.
Modified to read multi-dimensional GeoTiff images and reverse the images correct. 12 Jan 2012. DWF.
Write base filename as title for window if the DISPLAY keyword is set. 22 Feb 2012. DWF.
Had inexplicably left out CENTER_LATITUDE parameter in Equirectangular projection. 30 July 2012. DWF.
Copyright
Copyright (c) 2011-2012, Fanning Software Consulting, Inc.