sec : U Re: Fitting a map to an image [message #31021] |
Thu, 06 June 2002 15:42  |
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. . .
>
> ;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
Sean,
I'd say there's no way that you can just TV an image and *then*
call MAP_SET to define the geographic data space!
Try along the lines of :-
1. Map_set .. blah,blah
2. geo_warped_image = Map_image(image,.. blah,blah)
3. TV, geo_warped_image, xpos,ypos.. blah,blah
3. map_continents, /usa, color = 254, mlinethick=2
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 ;-)
------------------------------------------------------------ -----------------
|
|
|
Re: U Re: Fitting a map to an image [message #31170 is a reply to message #31021] |
Thu, 06 June 2002 16:06  |
Sean Raffuse
Messages: 46 Registered: July 2001
|
Member |
|
|
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
"Andrew Cool" <andrew.cool@dsto.defence.gov.au> wrote in message
news:3CFFE54D.EFC98763@dsto.defence.gov.au...
> 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.
. .
>>
>> ;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
>
> Sean,
>
> I'd say there's no way that you can just TV an image and *then*
> call MAP_SET to define the geographic data space!
>
> Try along the lines of :-
>
> 1. Map_set .. blah,blah
> 2. geo_warped_image = Map_image(image,.. blah,blah)
> 3. TV, geo_warped_image, xpos,ypos.. blah,blah
> 3. map_continents, /usa, color = 254, mlinethick=2
>
>
> 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 ;-)
> ------------------------------------------------------------ --------------
---
|
|
|