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 #85526 is a reply to message #85525] Wed, 14 August 2013 15:41 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Matteo writes:

> thank you very much. Every time I tried to respond I was being anticipated ;-). I realized I could start off a TAN background but the fact is that I need to batch process a lot of files containing flight transect to be overlaid to these maps (the map boundaries are automatically calculated). So I needed the code to just "know" where land and water are. Another solution could be using a land/water flag and switch CGCOLORFILL between TAN and SKYBLUE after checking if
there's any ocean pixel within the map boundaries. I guess it'd be similar in concept to your Convert_Coord solution. It is a bit annoying to see racial discrimination among inland water bodies (try map_limits = [29.,-125.,44.,-105], but it doesn't matter at this point.
>

Here is what I've finally come up with that I like quite a lot. It seems
to work correctly for all of your map limits.

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]
map_limits = [29.,-125.,44.,-105]
cgDisplay, 500, 350, /free
pos = [0.1,0.1, 0.9, 0.8]

; set map projection
cgmap_set, limit = map_limits, /mercator, position=pos

cgColorFill, Position=pos, Color='tg5'
cgMap_Continents, color='tan', /continents, /fill, /hires

; issue CGMAP_GSHHS
cgMap_GSHHS, datafile, Fill=1, Level=2, Color='black', $
Water_color='blu4'

; overdraw state borders
cgMap_Continents, /usa, color='yellow'
;cgMap_Continents, /continents, color='black', /hires
cgMap_GSHHS, datafile, color='black'

cgPolygon, Position=pos, Color='black'
END

Cheers,

Dvaid
--
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: Wed Oct 08 19:43:29 PDT 2025

Total time taken to generate the page: 0.00469 seconds