Matteo writes:
> Run the program first with map_limits set to include some Gulf
> waters around Lousiana (map_limits = [29.,-95.,34.,-88]). Then
> comment in the 'land only' option to exclude the water at the
> lower latitudes. In the latter case I obtain a SKYBLUE rather
> than a TAN background, which is obviously wrong. Furthermore,
> the WATER_COLOR keyword only works for inland water bodies,
> therefore CGCOLORFILL must be used to start from a SKYBLUE background.
OK, here is the problem. To speed things up I assume that I don't want
to draw polygons that are outside the plot area. So, I exclude any
polygon in which all of its vertices are outside the drawing area. The
polygon we want to draw in this zoomed-in case is, say, the United
States polygon. But, all of its vertices are outside the drawing area,
so it never gets drawn.
In this case, you can "fix" the problem by simply drawing with a tan
color instead of a skyblue color before drawing the inland water
polygons. In general, it would probably be a better idea to NOT use the
GSHHS data base for drawing such zoomed in plots. I think I would have
used cgMap_Continents instead, and used the GSHHS data for just the
inland waterways, if I needed that much detail. In other words, I think
this is a wrong tool for the job kind of problem. (Unless, of course,
you have a coffee machine nearby and you don't really care now long it
all takes.)
You have to "fill" oceans with the fill color before you start to draw
because the GSHHS data doesn't include ocean polygons. In other words,
the oceans are what's left (the negative space) after you fill all the
other polygons in the file.
> You will also notice that having to reissue CGMAP_SET at the end to
> draw state borders (yellow) over everything leads to imperfect
> overlap with the black GSHHS shorelines, expected because of
> the different resolution.
You don't have to do this, and I don't know why you think so. I would
just use cgMap_Continents and just draw the state outlines:
cgMap_Continents, /usa, color='yellow'
Here is the code I used to draw the "correct" plot in this particular
instance.
PRO test_gshhs
datafile='C:\IDL\data\gshhs\gshhs_2.2\gshhs\gshhs_i.b'
; include some water
;map_limits = [29.,-95.,34.,-88]
; land only
map_limits = [31.,-95.,34.,-88]
cgDisplay, 500, 350, /free
pos = [0.1,0.1, 0.9, 0.8]
; set map projection
cgmap_set, limit = map_limits, /mercator, position=pos
; set a SKYBLUE background
cgColorfill, [pos[0], pos[0], pos[2], pos[2], pos[0]], $
[pos[1], pos[3], pos[3], pos[1], pos[1]], $
/Normal, Color='tan'
; issue CGMAP_GSHHS
cgMap_GSHHS, datafile, Fill=1, Level=4, Color='black', $
Land='tan', Water_color='skyblue'
; overdraw state borders
cgMap_Continents, /usa, color='yellow'
END
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|