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

Home » Public Forums » archive » Re: Problem Plotting Symbols on a Map?
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
Re: Problem Plotting Symbols on a Map? [message #4535] Mon, 12 June 1995 00:00
rdhunt is currently offline  rdhunt
Messages: 6
Registered: January 1995
Junior Member
I have found a crude but quick solution to plotting filled circles
on a map projection. The trick is to identify the lat/lon location
for the center of the circle, convert this to device coordinates,
then plot and fill the circle using the /DEVICE option instead of
the /DATA option.

Rich


Richard D. Hunt
_/_/_/ _/ _/ _/ SANDIA NATIONAL LABORATORIES _/_/_/
_/ _/_/ _/ _/ P.O. Box 5800 _/_/
_/_/_/ _/ _/ _/ _/ Albuquerque, NM 87185-0965 _/_/_/_/_/_/
/ _/ _/_/ _/ Voice: (505)844-3193 _/ _/_/ _/
_/_/_/ _/ _/ _/_/_/_/ Fax: (505)844-5993 _/ _/_/ _/
E-Mail: rdhunt@sandia.gov _/_/_/
Re: Problem Plotting Symbols on a Map? [message #4577 is a reply to message #4535] Wed, 07 June 1995 00:00 Go to previous message
grunes is currently offline  grunes
Messages: 68
Registered: September 1993
Member
In article <3r28t9$4bpe@enzu.unm.edu> rdhunt@unm.edu writes:
> I am having trouble drawing filled circles on a map in IDL 4.0.
...

Actually your problem quite simple. Assuming RSI hasn't yet
fixed their map_set routine, it simply doesn't draw things
ere it says they are--e.g., features are drawn at the wrong
coordinates.

I devised a junky solution, which served my own needs, bypassing
map_set altogether, and using a very simple projection.
------------------------CUT HERE---------------------------------
;----------------------------------------------------------- -----------------
; Routine to Draw a map.
;----------------------------------------------------------- -----------------
pro draw_map,latmin,latmax,lonmin,lonmax,title

;Draw a map. It will then be possible to
; plot over the map using
; PLOTS,LON,LAT,NOCLIP=0
; (LON and LAT are arrays in degrees).

;latmin,latmax=minimum,maximum latitude (>0=north)
;lonmin,lonmax=minimum,maximum longitude (>0=east)
;title=plot title

;By Mitchell Grunes.
;Simplified from userlib procedure map_set.pro,
; because I could not figure out a way to get
; map_set.pro to give a simple rectangular
; projection, and because it seemed to be drawing
; things in the wrong places.

latmin2=latmin
latmax2=latmax
lonmin2=lonmin
lonmax2=lonmax
;Adjust aspect, lat and lon boundaries so that
;the lat and lon scales will be the same at map
;center. Approximately valid for default postscript
;in landscape mode.
aspect=8.3125/6.125/cos((latmin+latmax)/2.*!pi/180)
if (lonmax-lonmin) lt (latmax-latmin)*(aspect*.98) then begin
d=(latmax-latmin)*aspect-(lonmax-lonmin)
lonmin2=lonmin2-d/2
lonmax2=lonmax2+d/2
endif else if (latmax-latmin) lt (lonmax-lonmin)/(aspect*.98) then begin
d=(lonmax-lonmin)/aspect-(latmax-latmin)
latmin2=latmin2-d/2
latmax2=latmax2+d/2
endif
xticks=fix(lonmax2-lonmin2)
yticks=fix(latmax2-latmin2)
if xticks lt 3 or xticks gt 15 or lonmin2 ne fix(lonmin2) $
or lonmax2 ne fix(lonmax2) then xticks=0
if yticks lt 3 or yticks gt 15 or latmin2 ne fix(latmin2) $
or latmax2 ne fix(latmax2) then yticks=0
plot,[lonmin2,lonmin2,lonmax2,lonmax2,lonmin2], $
[latmin2,latmax2,latmax2,latmin2,latmin2],xstyle=1,ystyle=1, title=title, $
ticklen=1,xticks=xticks,yticks=yticks
close,1
openr,1,FILEPATH('supmap.dat',subdir = "maps"),/xdr,/stream
fbyte = [ 0, 71612L, 165096L]
nsegs = [ 283, 325, 594 ]
ij=2 ;0=course resolution map,1=U.S. only,2=All
point_lun, 1, fbyte(ij)
for i=1,nsegs(ij) do begin
npts = 0L
maxlat=0. & minlat=0. & maxlon=0. & minlon=0.
readu,1,npts,maxlat,minlat,maxlon,minlon
npts = npts / 2 ;# of points
xy = fltarr(2,npts)
readu,1,xy
if (maxlat lt latmin2) or (minlat gt latmax2) then goto,skipit
if (maxlon lt lonmin2) or (minlon gt lonmax2) then BEGIN
if (lonmax2 gt 180 and maxlon + 360 ge lonmin2) then goto,goon
if ( lonmin2 lt -180 and minlon -360 le lonmax2) then goto,goon
goto, skipit
endif
goon:
lat = xy(0,*) & lon = xy(1,*)
plots, lon,lat,NOCLIP=0,color=3*!d.n_colors/9
empty
skipit:
endfor
end
Re: Problem Plotting Symbols on a Map? [message #4581 is a reply to message #4577] Tue, 06 June 1995 00:00 Go to previous message
afl is currently offline  afl
Messages: 51
Registered: December 1994
Member
In article <3r28t9$4bpe@enzu.unm.edu>, rdhunt@unm.edu writes:
|>
|> I am having trouble drawing filled circles on a map in IDL 4.0.
|> Here is an example.
|>
|> IDL> map_set, /CYLINDRICAL, /GRID, /CONTINENTS
|> IDL> a = 2*findgen(1+long(180))/!radeg
|> IDL> xx=180+10*cos(a)
|> IDL> yy=10*sin(a)
|> IDL> plots,xx,yy,/data
|> IDL> polyfill, xx, yy, /DATA
|>
|> This should fill the circle which wraps around to the other side
|> of the map but it is doing the opposite. I think I know why it
|> happens but has anybody found a way to solve it?
|>
|> Any help is greatly appreciated.
|>
|> Rich
|>

If you devise a solution, I would love to know what it is.
Thanks!

--

Andrew F. Loughe email: afl@cdc.noaa.gov
University of Colorado, CIRES voice: (303) 492-0707
Campus Box 449 fax: (303) 497-7013
Boulder, CO 80309-0449 USA
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDL & MacX
Next Topic: Widget data editor

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

Current Time: Wed Oct 08 19:36:12 PDT 2025

Total time taken to generate the page: 0.00652 seconds