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

Home » Public Forums » archive » Re: I'm doing something wrong with map_image
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: I'm doing something wrong with map_image [message #76373 is a reply to message #76371] Tue, 31 May 2011 20:48 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
almost_like_a_metaphor writes:

> OK, from your example, what I want to display is a window that zooms
> in on just that blue box - where the coordinates of the box bound the
> window. Since I'm using simple cylindrical projection, I thought I
> could get away with just putting the image as a background to a plot
> window, as long as the axes and image corners aligned. I think my
> issue is that I was insisting on thinking of it as a data plot with an
> image background, and I really need to think of it as a displayed map
> image with shapes overplotted.
>
> So, if my base image is a global map, and all I want to do is take one
> 3x3 degree piece of it, display that, and plot my grid lines and data-
> overlay on it, do I have to create a small, subsampled "image" from
> your example above? Or can I simply display a smaller part of the
> image? in cgimage, image[lonrange,latrange]? Though in that case I
> think I'll have to convert my lat/lon ranges to image coordinates.

Let's suppose that each pixel represents 0.12 degree of latitude
or longitude (i.e., 360/3000. or 180/1500.) We can make a longitude
and latitude vector, like this:

lon = Scale_Vector(Findgen(3000), -180, 180)
lat = Scale_Vector(Findgen(1500), -90, 90)

Now, which indices in the longitude vector represents, say, 0 and 20
degrees of longitude? We can use Value_Locate to find out:

Print, Value_Locate(lon, [0,20])
1499 1666

We do the same thing with the latitude vector.

Print, Value_Locate(lat, [0,20])
749 916

Is this right?

Print, lon[[1499,1666]]
-0.0600128 19.9867

Print, lat[[749,916]]
-0.0600433 19.9933

Pretty close. So, we just zoom into this portion of
the image and set the map projection space up accordingly.

image = congrid(shift(cgDemoData(7), 180, 0), 3000, 1500)
subimage = image[1499:1666, 749:916]
cgLoadCT, 0
cgimage, subimage, /keep, position=p
map_set, /noerase, position=p, /cylindrical, $
limit=[-0.0600433, -0.0600128, 19.9933, 19.9867]
map_continents
map_grid
plots, 10, 10, psym=4, color=cgcolor('yellow')

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.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: How to make hidden Graphics?
Next Topic: I'm doing something wrong with map_image

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

Current Time: Mon Jul 13 19:40:06 PDT 2026

Total time taken to generate the page: 1.92572 seconds