comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Longstanding Map Overlay Problem Solved!
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Longstanding Map Overlay Problem Solved! [message #59231] Fri, 14 March 2008 14:00 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Folks,

For well over a year I have been pondering a map overlay problem.
The problem appears when trying to overlay continental outlines
on a GeoTIFF image. If you use the UV_BOX that is returned
in the map projection structure from MAP_PROJ_INIT to set up
a data coordinate space, then the outlines are just ever so
slightly wrong. However, it you use the UV_BOX that is
returned from MAP_PROJ_IMAGE, even if you don't warp the
image, the results are absolutely correct. The problem
(and solution) is described here.

http://www.dfanning.com/map_tips/tiffoverlay.html

With a great deal of help from Matt Savoie, I have now
identified the reason these two UV_BOXES are slightly
different. The answer comes down to a limitation in
MAP_PROJ_INIT.

Specifically, the limitation is that the LIMIT keyword
to MAP_PROJ_INIT can only accept a four-element vector
that describes two opposite corner points on the image.
The assumption is that the other two opposite corner
points can also be determined by this method. Unfortunately,
that is not a valid assumption for images that are in
some type of map projection already.

Rather, we need to use an 8-element LIMIT vector to
describe the location of a projected image in lat/lon
space. Something of this sort is available for MAP_SET,
although you must specify the left, top, right, and
bottom of the image, rather than its corners. But
if you try to use an 8-element LIMIT vector with
MAP_PROJ_INIT, it will accept it without argument, it
will just *completely* ignore its values.

Fortunately, MAP_PROJ_IMAGE *does* calculate the 8-element
limit correctly, and so does return the correct UV_BOX
to set up the data coordinate space. But, as Matt discovered,
it is also possible to set the data coordinate space directly
from values calculated from geotiff information in the file.

So, now we have two solutions, and it is only the most
commonly used method that is wrong. :-)

Anyway, I can't tell you how happy I am to know the reason
for this longstanding discrepancy and I look forward to
submitting a feature request to ITTVIS to get this cleared up.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Longstanding Map Overlay Problem Solved! [message #59313 is a reply to message #59231] Sun, 16 March 2008 10:33 Go to previous message
Wasit.Weather is currently offline  Wasit.Weather
Messages: 62
Registered: February 2008
Member
On Mar 16, 11:56 am, David Fanning <n...@dfanning.com> wrote:
> Bulrush writes:
>> I changed the path. Now I can compile it, however, It said can not
>> open the tif file.
>> READ_TIFF: C:\Documents and Settings\Zulher\AF03sep15b.n16-VIg: Cannot
>> open
>
> OK, the program needs to know where the file is located.
> You can either modify the program to include the complete
> file path to the image file (wherever you put it), or
> you can put the file in the directory where you are running
> the program. (Sounds to me like you are running the program
> from some other directory than the one it resides in.)
>
> The easiest thing, if you have put all these files into
> the same place, is to just make sure that is the place
> you are running IDL from. Suppose you put all these files
> in C:\Coyote (a good place). And you have added this
> directory to your IDL path:
>
>    IDL> !PATH = 'C:\coyote;' + !PATH
>
> Then, you need to make this your current directory:
>
>    IDL> CD, 'C:\coyote'
>
> Now, if all your files are here, and your data file is
> here, you can run this program. :-)
>
> You can find your current directory in IDL, by doing
> this:
>
>    IDL> CD, CURRENT=thisDir & Print, thisDir
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

YOU ARE GREAT!
Thanks. It works!
Re: Longstanding Map Overlay Problem Solved! [message #59314 is a reply to message #59231] Sun, 16 March 2008 09:56 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Bulrush writes:

> I changed the path. Now I can compile it, however, It said can not
> open the tif file.
> READ_TIFF: C:\Documents and Settings\Zulher\AF03sep15b.n16-VIg: Cannot
> open

OK, the program needs to know where the file is located.
You can either modify the program to include the complete
file path to the image file (wherever you put it), or
you can put the file in the directory where you are running
the program. (Sounds to me like you are running the program
from some other directory than the one it resides in.)

The easiest thing, if you have put all these files into
the same place, is to just make sure that is the place
you are running IDL from. Suppose you put all these files
in C:\Coyote (a good place). And you have added this
directory to your IDL path:

IDL> !PATH = 'C:\coyote;' + !PATH

Then, you need to make this your current directory:

IDL> CD, 'C:\coyote'

Now, if all your files are here, and your data file is
here, you can run this program. :-)

You can find your current directory in IDL, by doing
this:

IDL> CD, CURRENT=thisDir & Print, thisDir

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Longstanding Map Overlay Problem Solved! [message #59315 is a reply to message #59231] Sun, 16 March 2008 08:40 Go to previous message
Wasit.Weather is currently offline  Wasit.Weather
Messages: 62
Registered: February 2008
Member
On Mar 16, 9:54 am, David Fanning <n...@dfanning.com> wrote:
> Bulrush writes:
>> I downloaded all of your programs into the same directory. Still can
>> not be compiled.
>> Stating the error in line 74 at  "/Triple"
>
> OK, let's try this.
>
>    IDL> print, !path
>
> Are these files in any one of the directories listed
> on your path? They will have to be to get compiled
> correctly.
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

Thanks!
I changed the path. Now I can compile it, however, It said can not
open the tif file.
READ_TIFF: C:\Documents and Settings\Zulher\AF03sep15b.n16-VIg: Cannot
open
Re: Longstanding Map Overlay Problem Solved! [message #59316 is a reply to message #59231] Sun, 16 March 2008 07:54 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Bulrush writes:

> I downloaded all of your programs into the same directory. Still can
> not be compiled.
> Stating the error in line 74 at "/Triple"

OK, let's try this.

IDL> print, !path

Are these files in any one of the directories listed
on your path? They will have to be to get compiled
correctly.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Longstanding Map Overlay Problem Solved! [message #59317 is a reply to message #59231] Sun, 16 March 2008 07:39 Go to previous message
Wasit.Weather is currently offline  Wasit.Weather
Messages: 62
Registered: February 2008
Member
On Mar 16, 12:38 am, David Fanning <n...@dfanning.com> wrote:
> Bulrush writes:
>> I downloaded all of the exampel codes into IDL lib folder. however,the
>> program can not be compiled and stating following error.
>> TVLCT, FSC_Color('ivory', /Triple), 0
>
>> Syntax error.
>>   At: F:\IDLPractice\data\MapOverlay\tiffoverlay.pro, Line 74
>> 1 Compilation error(s) in module TIFFOVERLAY.
>
> Well, let's see if I can make this simpler. Download this
> file and unzip it into the directory with the example
> files:
>
>   http://www.dfanning.com/programs/coyoteprograms.zip
>
> The country outlines are part of the IDL distribution.
> There is nothing to "get". If you want to "get" something
> (and I wouldn't recommend it in this case), you can try
> the GSHHS shoreline data base:
>
>   http://www.dfanning.com/map_tips/gshhs.html
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

Well,
I downloaded all of your programs into the same directory. Still can
not be compiled.
Stating the error in line 74 at "/Triple"

Thanks anyway!
Re: Longstanding Map Overlay Problem Solved! [message #59320 is a reply to message #59231] Sat, 15 March 2008 22:38 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Bulrush writes:

> I downloaded all of the exampel codes into IDL lib folder. however,the
> program can not be compiled and stating following error.
> TVLCT, FSC_Color('ivory', /Triple), 0
>
> Syntax error.
> At: F:\IDLPractice\data\MapOverlay\tiffoverlay.pro, Line 74
> 1 Compilation error(s) in module TIFFOVERLAY.

Well, let's see if I can make this simpler. Download this
file and unzip it into the directory with the example
files:

http://www.dfanning.com/programs/coyoteprograms.zip

The country outlines are part of the IDL distribution.
There is nothing to "get". If you want to "get" something
(and I wouldn't recommend it in this case), you can try
the GSHHS shoreline data base:

http://www.dfanning.com/map_tips/gshhs.html

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: index arrays of structures
Next Topic: Interactive Image Locations and Values

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 14:54:24 PDT 2025

Total time taken to generate the page: 0.71807 seconds