In article <6s6l44$mf1$1@nnrp1.dejanews.com>, seanr@possys.com wrote:
> Well, for those who have been following this thread, I have been playing with
> MAP_SET and MAP_IMAGE and feel that I understand them much better now. I have
> discovered a way to keep the resolution of my imagery *almost* the same.
> Basically, MAP_SET will create a window of a default size if one does not
> exist, and MAP_IMAGE will place the image warped to the selected projection
> within that window...in a best fit. So, I set things up so that the window
> size = image size of the raw image. (I will have to use tiling on my full
> implementation anyway, so having a small window to put this all to is no big
> deal, I will probably use a pixmap window, or possibly the z-buffer). Here is
> a small snippet of my test code that will place the sub image in the map
> projection and keep it at the correct resolution:
>
I'm not sure the following answers your problem, but here is a small
procedure to simplify superpositions of images and maps. It works correctly
for Mercator and cylindrical projection with Map_set 1.33 (shipped with IDL
4), and haldles PS output correctly. Just forget the prep_map function, it
just corrects a personal problem I had with map_set.
pro TVmap, image, _extra=pipo, Ps=ps, grid=grid, label=label,
position=position,$
limit=limit
; ====================================================
; Superimpose a map to an image.
;
; Les limitse sont souvent d�cal�es d'1 pixel, probl�me d'arrrondi
; (d�pend du syst�me)...
; ====================================================
; Il faut intercepter les mots-clefs � tester, et ils ne sont alors plus
dans _extra
if keyword_set(position) then begin
message, /continue, 'Keyword POSITION no allowed (automatic)'
return
endif
if n_elements(grid) eq 0 then grid=1 ; defaut is ON
if n_elements(label) eq 0 then label=1
; Limit is adjusted if provided as a 4-elt vector.
; Otherwise, map_set defaults are used
If n_elements(limit) eq 4 then begin prep_map, latcent, longcent, limit,
_extra=pipo
endif else latcent=(longcent=(limit=0))
sz=size(image)
Xscreen=sz(1) + 40. ; d�calages pour mise en page
Yscreen=sz(2) + 80.
!P.font=-1
th=1
if keyword_set(ps) then begin
OldDevice = !D.name
set_plot,'ps'
!P.font=0
; coefPS=!D.x_px_cm/40. ;image � la m�me taille que sur l'�cran
coefPS=min([!D.X_vsize/Xscreen,!D.Y_vsize/Yscreen]) ;image sur toute la feuille
addPS=0.
device,filename='TVmap.ps',/color,bits=8,/landscape,/Bold
th=2
endif else begin
window, /free, xsize=Xscreen, ysize=Yscreen
coefPS=1.
addPS=1.
endelse
px0 = 20. ; small shift for page layout
py0 = 20.
;print, sz, coefPS, !D.x_vsize,!D.y_vsize
; Back to normal coordinates for Map_set
; adjust for odd and even dimensions (frame is always suposed to be
inside image)
qx=[px0,px0+sz(1)-(sz(1) mod 2)]*coefPS/(!D.X_vsize+addPS)
qy=[py0,py0+sz(2)-(sz(2) mod 2)]*coefPS/(!D.Y_vsize+addPS)
tv, image, px0*coefPS,py0*coefPS,xsize=sz(1)*coefPS, ysize=sz(2)*coefPS
;print, qx, qy
del=(qx(1)-qx(0))*0.01 ; Compensate a small dilatation of limits
qx(0)=qx(0)-del ; performed in MAP_SET with a similar dilatation
qx(1)=qx(1)+del ; of the plotting area.
del=(qy(1)-qy(0))*0.01
qy(0)=qy(0)-del
qy(1)=qy(1)+del
print, latcent, longcent
print, limit
map_set,latcent, longcent ,grid=grid, limit=limit,/noerase, label=label,$
londel=30.,latdel=30.,position=[qx(0),qy(0),qx(1),qy(1)],$
glinethick=th, _extra=pipo
; Ici, il faut tester la condition de sortie de Map_set et continuer en cas
d'erreur
!P.font=-1
if keyword_set(ps) then begin
device,/close
Set_Plot, OldDevice
endif
end
--
St�phane Erard
Institut d'Astrophysique Spatiale
Orsay, France
www.ias.fr/cdp
erard@ias.fr
|