|
Re: map projections webinar [message #78022 is a reply to message #77920] |
Thu, 20 October 2011 19:19  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning writes:
> I discovered the work-around for the broken POSITION
> keyword by listening to Mark Piper's map projection
> webinar this afternoon.
>
> Apparently, you can use the Scale and Translate methods
> for the MAP function to effect a rudimentary positioning
> of the map projection in the graphics window. > ...
> I still don't see how to set the limit of the map projection,
> so that I just see the portion of it that I want to see.
> It is difficult to move forward because so many keywords just
> seem to be broken. (At least they appear to be ignored. I presume
> they are broken.)
Well, I wish I hadn't had to spend two full days on this,
but I have *finally* figured out how to get what I want
out of the function graphics map projection routines.
My initial approach was to create a map object and try
to add an image to that. That is NOT the way to proceed
using function graphics! I am not sure what is wrong with
the Map() function, but if you try to create it first,
it is absolutely impossible to control. It would appear
(from LOTS of experimenting) that the POSITION, LIMIT,
XRANGE, and YRANGE keywords are all broken.
I'm not absolutely *sure* they are broken, because they
appear to work correctly if used in another context
(see below), but I know for sure creating a Map()
object first is a BIG mistake!
The proper way to proceed is to create an image object
and add the map projection stuff to that. Doing just
that suddenly causes a lot of things that previously
appeared broken to magically work! I don't mean work
in the way you expect them to work, necessarily, but
they work well enough that you suspect there might
be some intelligence at work somewhere, whereas
before... Well, it does no good to go there. :-)
I've written an article that explains how one could
navigate a geoTiff image in such a way as to annotate
it with continental outlines and map grids in both
Coyote Graphics and in Function Graphics.
http://www.idlcoyote.com/map_tips/geotiffan.php
Oddly enough, the function graphics approach is
simpler and I have to say it is about the first thing
I've seen in this graphics system that gives me reason
to think I might actually use it some day. Although,
when you compare it to the Coyote Graphics approach
you are probably going to be dismayed at its speed
(or, rather, lack of it!). In any case, it's a ray
of hope in an otherwise dark sky. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: map projections webinar [message #78032 is a reply to message #77920] |
Thu, 20 October 2011 12:57  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning writes:
> It doesn't work in that I can't appear to "position"
> a map object in the graphics window. In other words,
> this code appears to ignore the POSITION keyword:
>
> m = MAP('Albers Equal Area', $
> ELLIPSOID='WGS 84', $ ; WGS84
> CENTER_LATITUDE=geotag.PROJNATORIGINLATGEOKEY, $
> CENTER_LONGITUDE=geotag.PROJNATORIGINLONGGEOKEY, $
> STANDARD_PAR1=geotag.PROJSTDPARALLEL1GEOKEY, $
> STANDARD_PAR2=geotag.PROJSTDPARALLEL2GEOKEY, $
> XRANGE=xrange, YRANGE=yrange, $
> POSITION=[0.025, 0.025, 0.975, 0.85])
>
> Well, it ignores the XRANGE and YRANGE keywords, too,
> but this is an error I know about. I fix that error
> by doing this:
>
> m.xrange = xrange
> m.yrange = yrange
>
> But, when I try the same technique with the ignored
> POSITION keyword:
>
> m.position =[0.025, 0.025, 0.975, 0.85]
>
> I am given this error:
>
> % MAPPROJECTION: Unknown property: POSITION
>
> There are other problems as well, but if I could solve
> this one I would be moving forward.
I discovered the work-around for the broken POSITION
keyword by listening to Mark Piper's map projection
webinar this afternoon.
Apparently, you can use the Scale and Translate methods
for the MAP function to effect a rudimentary positioning
of the map projection in the graphics window. It's an
iterative process, because there is no rational explanation
for what values you should use (as least that I can see),
but I did get the map to move enough for me to fit a title
above it.
My code looks like this now:
m = MAP('Albers Equal Area', $
ELLIPSOID='WGS 84', $ ; WGS84
CENTER_LATITUDE=geotag.PROJNATORIGINLATGEOKEY, $
CENTER_LONGITUDE=geotag.PROJNATORIGINLONGGEOKEY, $
STANDARD_PAR1=geotag.PROJSTDPARALLEL1GEOKEY, $
STANDARD_PAR2=geotag.PROJSTDPARALLEL2GEOKEY, $
XRANGE=xrange, YRANGE=yrange, $
POSITION=[0.025, 0.025, 0.975, 0.85])
; The range doesn't get set in the call to Map. Have to
; set the range manually.
m.xrange = xrange
m.yrange = yrange
; A similar "correction" for ignored POSITION keyword tells me
; POSITION is an unknown property for MAPPROJECTION. Use SCALE
; and TRANSLATE methods to compensate.
; m.position = [0.025, 0.025, 0.975, 0.85]
m.scale, 0.8, 0.8, 1.0
m.translate, 0, -0.075, 0, /Normal
I've moved the code over to a more permanent location, because
I want to use this in an article I am writing.
http://www.idlcoyote.com/map_tips/cg_map_projections_webinar .zip
I still don't see how to set the limit of the map projection,
so that I just see the portion of it that I want to see.
It is difficult to move forward because so many keywords just
seem to be broken. (At least they appear to be ignored. I presume
they are broken.)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: map projections webinar [message #78047 is a reply to message #77920] |
Wed, 19 October 2011 12:00  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning writes:
> And I put an attempt at a Function Graphics file
> here:
>
> http://www.idlcoyote.com/misc/ng_geotiff_image.pro
>
> I cannot size the image appropriately, or even leave
> room in the window for the title. If someone could
> make it work, I would be *extremely* grateful. :-)
Note to self: No more programming at 3AM!!
I just turned my attention back to this project, and
realized that the ng_geotiff_image.pro program I put
up there last night (early this morning!) wasn't
working. I've replaced it with one that is:
http://www.idlcoyote.com/misc/ng_geotiff_image.pro
Well, "working" as in compiles and displays something.
It doesn't work in that I can't appear to "position"
a map object in the graphics window. In other words,
this code appears to ignore the POSITION keyword:
m = MAP('Albers Equal Area', $
ELLIPSOID='WGS 84', $ ; WGS84
CENTER_LATITUDE=geotag.PROJNATORIGINLATGEOKEY, $
CENTER_LONGITUDE=geotag.PROJNATORIGINLONGGEOKEY, $
STANDARD_PAR1=geotag.PROJSTDPARALLEL1GEOKEY, $
STANDARD_PAR2=geotag.PROJSTDPARALLEL2GEOKEY, $
XRANGE=xrange, YRANGE=yrange, $
POSITION=[0.025, 0.025, 0.975, 0.85])
Well, it ignores the XRANGE and YRANGE keywords, too,
but this is an error I know about. I fix that error
by doing this:
m.xrange = xrange
m.yrange = yrange
But, when I try the same technique with the ignored
POSITION keyword:
m.position =[0.025, 0.025, 0.975, 0.85]
I am given this error:
% MAPPROJECTION: Unknown property: POSITION
There are other problems as well, but if I could solve
this one I would be moving forward.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: map projections webinar [message #78053 is a reply to message #77920] |
Wed, 19 October 2011 07:01  |
d.poreh
Messages: 406 Registered: October 2007
|
Senior Member |
|
|
On Oct 19, 4:00 pm, David Fanning <n...@dfanning.com> wrote:
> Dave Poreh writes:
>> Does it work with IDL 8.0 or we need 8.01?
>
> Well, it works with *any* version of IDL, as
> far as I know. :-)
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
thanks David!
Cheers,
Dave
|
|
|
Re: map projections webinar [message #78054 is a reply to message #77920] |
Wed, 19 October 2011 07:00  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Dave Poreh writes:
> Does it work with IDL 8.0 or we need 8.01?
Well, it works with *any* version of IDL, as
far as I know. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: map projections webinar [message #78055 is a reply to message #77920] |
Wed, 19 October 2011 05:11  |
d.poreh
Messages: 406 Registered: October 2007
|
Senior Member |
|
|
On Oct 19, 10:38 am, David Fanning <n...@dfanning.com> wrote:
> David Fanning writes:
>> Mark's files are probably not complete yet, but I noticed
>> one map projection task conspicuously missing. I would say
>> more than half the time when I am working with map projections
>> I have an image that has already been projected. What I want
>> to do is set up a map data coordinate space that is
>> coincident with the image, so I can draw continental
>> outlines, grid lines, station plots, etc. I am thinking,
>> for example, of any geoTiff image that I might download.
>
>> If Mark wanted to take this on for his webinar, here
>> is an appropriate image.
>
>> http://www.idlcoyote.com/misc/AF03sep15b.n16-VIg.tif.gz
>
>> I would be particularly interested in how to set up the
>> map data coordinate space for this image in function
>> graphics, for example. I've been able to create such
>> a coordinate system and display the image. But all goes
>> to hell when I resize the window. :-(
>
> I made an attempt at this tonight, as sleep still
> eludes me. :-(
>
> I put the Coyote Graphics file here:
>
> http://www.idlcoyote.com/misc/cg_geotiff_image.pro
>
> And I put an attempt at a Function Graphics file
> here:
>
> http://www.idlcoyote.com/misc/ng_geotiff_image.pro
>
> I cannot size the image appropriately, or even leave
> room in the window for the title. If someone could
> make it work, I would be *extremely* grateful. :-)
>
> Going to bed now. :-)
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Does it work with IDL 8.0 or we need 8.01?
Cheers,
Dave
|
|
|
Re: map projections webinar [message #78057 is a reply to message #77920] |
Wed, 19 October 2011 01:38  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning writes:
> Mark's files are probably not complete yet, but I noticed
> one map projection task conspicuously missing. I would say
> more than half the time when I am working with map projections
> I have an image that has already been projected. What I want
> to do is set up a map data coordinate space that is
> coincident with the image, so I can draw continental
> outlines, grid lines, station plots, etc. I am thinking,
> for example, of any geoTiff image that I might download.
>
> If Mark wanted to take this on for his webinar, here
> is an appropriate image.
>
> http://www.idlcoyote.com/misc/AF03sep15b.n16-VIg.tif.gz
>
> I would be particularly interested in how to set up the
> map data coordinate space for this image in function
> graphics, for example. I've been able to create such
> a coordinate system and display the image. But all goes
> to hell when I resize the window. :-(
I made an attempt at this tonight, as sleep still
eludes me. :-(
I put the Coyote Graphics file here:
http://www.idlcoyote.com/misc/cg_geotiff_image.pro
And I put an attempt at a Function Graphics file
here:
http://www.idlcoyote.com/misc/ng_geotiff_image.pro
I cannot size the image appropriately, or even leave
room in the window for the title. If someone could
make it work, I would be *extremely* grateful. :-)
Going to bed now. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: map projections webinar [message #78058 is a reply to message #77920] |
Wed, 19 October 2011 00:33  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Mark Piper writes:
> This Thursday, October 20, I'll be giving a set of webinars on using
map
> projection routines in IDL. For information and signup, please see
>
> http://www.ittvis.com/EventsTraining/LiveWebSeminars.aspx
>
> If you'd like to get my example programs beforehand, please follow this link
>
> http://bit.ly/IDL-webinar-files
>
> and look for "Using Map Projection Routines in IDL".
Because my sleep schedule is still a mess and I have no
idea what time or day it is, I decided to download these
webinar files and see if I could learn something. Mark
has written several programs to compare how you do various
map projection tasks in both direct graphics and in function
graphics.
Since Mark is making use of some Coyote Library routines
(albeit retired ones!) in his direct graphics examples, I
thought it might be interesting to write the same programs
from a Coyote Graphics point of view. Those of you who
have downloaded the Coyote Library may wish to compare and
contrast these routines with the routines Mark has written.
I've put the files here.
http://www.idlcoyote.com/misc/cg_map_projections.zip
They rely on software and data files that Mark is providing
for the webinar, so download his files first, then throw
the Coyote Graphics files in the same src directory as his
files. They are appropriately prepended with a "cg" extension
so you can tell them apart from Mark's files.
Each file is written as a simple display routine, which
can be displayed in a window or sent to a PostScript file,
etc. An example main-level program is at the end of all the
files, which will load the display routine into a resizeable
cgWindow, where you have access to PostScript and raster
output, as usual. If ImageMagick is installed, of course,
you have access to raster file output via PostScript
intermediate files and their extremely nice fonts.
Mark's files are probably not complete yet, but I noticed
one map projection task conspicuously missing. I would say
more than half the time when I am working with map projections
I have an image that has already been projected. What I want
to do is set up a map data coordinate space that is
coincident with the image, so I can draw continental
outlines, grid lines, station plots, etc. I am thinking,
for example, of any geoTiff image that I might download.
If Mark wanted to take this on for his webinar, here
is an appropriate image.
http://www.idlcoyote.com/misc/AF03sep15b.n16-VIg.tif.gz
I would be particularly interested in how to set up the
map data coordinate space for this image in function
graphics, for example. I've been able to create such
a coordinate system and display the image. But all goes
to hell when I resize the window. :-(
Here is an article that describes how to do such a thing
using Coyote Graphics:
http://www.idlcoyote.com/map_tips/tiffoverlay.html
If I wake up before noon, I may spend a little more time
on this tomorrow. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|