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

Home » Public Forums » archive » Viewing Shapefiles in IDL
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Viewing Shapefiles in IDL [message #70995] Sun, 16 May 2010 06:52
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Folks,

I had occasion this week to want to view a shapefile of
Greenland on a map. Several years ago I had written a
couple of example programs to show people how this could
be done with the states.shp file that is distributed with
IDL:

http://www.dfanning.com/map_tips/shapefile.html

The program I wrote to do that, DrawStates, was more
general than users were led to believe by my poor
choice of keyword names (to say nothing of the name
of the program!). It has been in the back of my
mind for a long time to fix that.

Then, coincidentally, on the same day I needed this
functionality, I got a request from a user to show
her how DrawStates could be used with Map_Proj_Init,
which oddly enough, was the same problem I was struggling
with, since in the years since I wrote the program I had
completely abandoned MAP_SET for MAP_PROJ_INIT (or,
rather, its more useful variant, the MapCoord object).

Fate, as they say. :-)

The long and short is that I have written a new shapefile
program named DrawShapes that does much the same thing
as DrawStates, but in a more general way. Plus, you
can pass it a MapCoord object (so it knows how to draw
on *your* map) and so it can convert lat/lon coordinates
to the necessary XY coordinates of the plot.

One added feature makes it a general purpose viewing tool.
If you set the /AUTODRAW keyword, the shapefile will be
queried for its overall "boundaries" and a data coordinate
system corresponding to these boundaries will be set up
(and a window opened) so that the shapefile contents can
be drawn for you. This is not perfect, but it beats
having to come up with the proper map coordinate parameters
off the top of your head.

(And as an aid to setting the map coordinate boundaries,
I have added XRANGE and YRANGE output keywords to ShapeInfo,
so that these critical ranges for MapCoord can be set prior
to passing the MapCoord object to DrawShapes.)

You can find the program here:

http://www.dfanning.com/programs/drawshapes.pro

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Previous Topic: Re: Non-linear data selection
Next Topic: 2-d histogram and Routines of same name

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

Current Time: Wed Oct 08 15:18:58 PDT 2025

Total time taken to generate the page: 0.00243 seconds