Navigating Map Projected Images

QUESTION: Most of the satellite and remote sensing data I download
these days comes in GeoTiff or netCDF files. In the vast majority of cases, the data providers
have gridded their data onto map projected meter grids, which are described by metadata
in the data files. These image files are easily navigated by creating a map projection space
with Map_Proj_Init or the even more useful Coyote Graphics routine, cgMap.

I realize the Map function has not worked properly since it was released in IDL 8.0, but
I really was expecting it to be fixed by now in IDL 8.2. But, this appears not to be the case.

What I am trying to do is very simple. I
obtain a static map from Google, as
a 4x600x600 PNG file, using the code below. This map is centered on Fort Collins, Colorado
at latitude 40.6 and longitude -105.1.

I would like to display this image in a graphics window with box axes around it.
With Coyote Graphics routines, I use the following code to calculate an X and Y
range for the image in projected meter space and to display the image with box axes.

This resulted in an image displayed! But, it filled up the window instead of
having a margin around it. But, as it seemed like I was on the right track, I tried
substituting a POSITION keyword for the LOCATION keyword.

This finally displayed the image properly in the window. And, there was some
evidence of a map projection, because I could click in the window and have my
location updated in map coordinate space. Unfortunately, the map coordinates were
wrong! The center of the image was listed as being at -149.5 in longitude and 40.3
in latitude.

But, maybe this is because the ranges were calculated from a center latitude and
longitude of 0.0. I tried this variation in which I left the CENTER_LATITUDE and
CENTER_LONGITUDE keywords off the command.

You see the final result in the figure below. As you can see, this wasn't too bad, although I still haven't been able to
figure out how to get box axes. Maybe that's just asking too darn much from
function graphics!

A Google static map image displayed with
the Map function.

You can find a program named mapnogrid.pro
that allows you to run the examples
shown in this article.

Adding Box Axes

With a little help from the good folks at ExcelisVIS, I finally discovered the
correct way to display box axes on my image plot. The secret is to not set the
LIMIT and BOX_AXES keywords when you create the image (and, thus, the map
projection.) In fact, setting the LIMIT keyword when you create the image is
exactly what is causing the graphics window to be blank! This is a known
bug in version 8.2 of the software.

Rather, you should set the LIMIT and BOX_AXES properties of the map projection
in the interval between when you display the image itself and when you are ready
to throw your computer out the second story window!

You see the result in the figure below. The box axes are not labeled like normal
box axes, but that is left as an exercise for the reader. Note, too, that setting
the limit like this has the effect of blurring the map image just a bit. I think
this is probably because the image is now being warped into the map projection,
rather than the map projection being applied to the image. You can see the blurring
readily, if you compare this image to the one created with Coyote Graphics routines
above.

A Google static map image displayed with
box axes. Note the slight, but noticeable, blurring of the image.

Box Axis Labels

An astute reader has written in to say that you can manipulate the map projection
labels in the last figure to have a box axis type orientation, by doing something
like this.

You see the result in the figure below. Note that only two sides of the
plot can be labeled by this method. If you wanted a normal looking map
with box axes, you would have to create your own text labels, presumably.

At least two sides of a map with box
axes are labeled using this rotate and position method.

Avoid Image Blurring

The image blurring problem described above can be corrected by
separating the image display from the creation of the map projection.
What is essential to know about this, however, is that the LIMIT keyword
to the Map function is broken. (It almost works, but not really. If you
try to use the LIMIT keyword, you
will get erroneous results.) You must
set the limit of the map projection after you create the map object.

The following code will result in an unblurred image with box axes (labeled
on only two sides, of course).