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

Home » Public Forums » archive » Fitting a map to an image
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
Fitting a map to an image [message #31023] Thu, 06 June 2002 13:59 Go to next message
Sean Raffuse is currently offline  Sean Raffuse
Messages: 46
Registered: July 2001
Member
Hello.

I have an image of known size and flat geocoordinates. I want to overlay
the US states vector in a display window on top of the image. My problem is
that I cannot get the two to match up properly. There seems to be a border
on the vector, but the image draws to the edge of the window. I tried using
the noborder keyword on my call to map_set and also tried setting the !x and
!y margins to zero. No luck. Can you help? Here is the relevant code. . .


;set margins to zero
x_margin = !x.margin
y_margin = !y.margin
!x.margin = [0,0]
!y.margin = [0,0]

;write output to screen
Device, decomposed=0
image = reverse(InArray1, 2)
LoadCT, 40
scaledImage = bytscl(image, Min=0, Max=0.5, Top=255)
window, 0, xsize=nscans, ysize=nlines
TV, scaledImage

;setup the map
xspan = pixelsize*nscans
yspan = pixelsize*nlines
upperleftlat = mc[3]
upperleftlon = mc[2]
lowerlat = upperleftlat - yspan
rightlon = upperleftlon + xspan
map_set, limit=[lowerlat,upperleftlon,upperleftlat,rightlon], /noborder,
/noerase
map_continents, /usa, color = 254, mlinethick=2

;write to jpeg
image = tvread(filename=out_name, /JPEG, /nodialog, Quality=100)


***thanks to David Fanning for the tvread procedure***


-Sean Raffuse
Sec : U Re: Fitting a map to an image [message #31168 is a reply to message #31023] Thu, 06 June 2002 16:30 Go to previous message
Andrew Cool is currently offline  Andrew Cool
Messages: 219
Registered: January 1996
Senior Member
Sean Raffuse wrote:
>
> I don't know if this is unwise, but I don't want to warp the image any. It
> has already been georeferenced once using ENVI. All I need is a window and
> map setting that matches the image, which has defined size and
> geocoordinates with geographic lat/lon projection. I'd rather warp the map
> then the large image.
>
> -Sean


Well, I'll shut then, and leave it to the satellite guys out there.

But 3D into 2D doesn't normally go without something getting warped
along the way.

Andrew


------------------------------------------------------------ -----------------
Andrew D. Cool .->-.
Electromagnetics & Propagation Group '-<-'
Intelligence, Surveillance & Reconnaissance Division Transmitted on
Defence Science & Technology Organisation 100% recycled
PO Box 1500, Edinburgh electrons
South Australia 5111

Phone : 061 8 8259 5740 Fax : 061 8 8259 6673
Email : andrew.cool@crapdsto.defence.gov.au
Please remove the crap from my email address to reply ;-)
------------------------------------------------------------ -----------------
sec : U Re: Fitting a map to an image [message #31169 is a reply to message #31023] Thu, 06 June 2002 16:22 Go to previous message
Andrew Cool is currently offline  Andrew Cool
Messages: 219
Registered: January 1996
Senior Member
Sean Raffuse wrote:
>
> Hello.
>
> I have an image of known size and flat geocoordinates. I want to overlay
> the US states vector in a display window on top of the image. My problem is
> that I cannot get the two to match up properly. There seems to be a border
> on the vector, but the image draws to the edge of the window. I tried using
> the noborder keyword on my call to map_set and also tried setting the !x and
> !y margins to zero. No luck. Can you help? Here is the relevant code. . .

I may as well throw in the example...


PRO USA

Device, decomposed=0

window
LoadCT, 40
!P.position=[0.1,0.1,0.9,0.9]
lowerlat = 25
upperleftlat = 50
upperleftlon = 360-140
rightlon = 360-60

map_set,40,-110,0,limit=[lowerlat,upperleftlon,upperleftlat, rightlon],/merc
image = DIST(800,250)
geo_warped_image = map_image(image,startx,starty,$
LATMIN = lowerlat,$
LATMAX = upperleftlat,$
LONMIN = upperleftlon,$
LONMAX = rightlon,$
COMPRESS = 1)

TV, BYTSCL(geo_warped_image), startx,starty,/device

map_continents, /usa, color = 200, mlinethick=2
MAP_GRID,/BOX,color = 200

END



------------------------------------------------------------ -----------------
Andrew D. Cool .->-.
Electromagnetics & Propagation Group '-<-'
Intelligence, Surveillance & Reconnaissance Division Transmitted on
Defence Science & Technology Organisation 100% recycled
PO Box 1500, Edinburgh electrons
South Australia 5111

Phone : 061 8 8259 5740 Fax : 061 8 8259 6673
Email : andrew.cool@crapdsto.defence.gov.au
Please remove the crap from my email address to reply ;-)
------------------------------------------------------------ -----------------
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: sec : U Re: Fitting a map to an image
Next Topic: HELP:: call_external/ c errors

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

Current Time: Wed Oct 08 14:56:29 PDT 2025

Total time taken to generate the page: 0.00670 seconds