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

Home » Public Forums » archive » CGMAP_GSHHS: problem with land/water colors
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: CGMAP_GSHHS: problem with land/water colors [message #85522 is a reply to message #85515] Wed, 14 August 2013 13:08 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
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.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Not IDL Related Question
Next Topic: copying text to the system clipboard

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

Current Time: Fri Nov 28 17:00:13 PST 2025

Total time taken to generate the page: 0.00854 seconds