Coyote's Guide to IDL Programming

Centering an IDL Map Projection

QUESTION: John Kwiatkowski asked this question in the IDL newsgroup:

I can't figure out how to draw a map that spans the International dateline (i.e., the meridian where longitude is 180 (or -180)).

If I go right up to the dateline but not over it, I get a nice map including Japan:

   map_set, /grid, /continent, limit=[0,100,50,180]

However, if I cross the dateline I get some grid lines but no Japan:

   map_set, /grid, /continent, limit=[0,100,50,-160]

Also, I can't seem to get the LIMIT keyword to behave. For example , if I want a map of Florida, with a LIMIT of [20,-88,30,-80]:

   map_set, limit=[20,-88,30,-80], /continent, /label

I get a map from 20 to 26 lat and -88 to -82 lon. How can I force IDL to listen to my limits?

ANSWER: The answer to all of these questions (and many other Map_Set questions as well) is suprisinging easy: Make sure you include the latitude and longitude parameters that indicate the center of the map projection in the Map_Set call. And, in particular, be absolutely certain that the longitude parameter is within the longitude bounds given by the Limit keyword. For example, the code above can be fixed by typing this command:

   Map_Set, 25, 150, /Grid, /Continent, Limit=[0, 100, 50, -160]

You see below the map projections with and without the map centering parameters.

The map projection without centering parameters. The map projection with centering parameters.

[Return to IDL Programming Tips]