Shapefiles Gone Wild [message #79474] |
Fri, 02 March 2012 12:03 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Folks,
Andrew Cool, an always reliable breaker of my well-written
programs, sent me an interesting shapefile problem yesterday.
In this case my programs were (mostly!) well-enough written,
but Andrew was making a common false assumption about
the shapefile he was using. Since I've run into this a
couple of times, I thought I might write an article
about it.
The assumption Andrew made (and which I have made many
times myself!) is that shapefiles always contain latitude
and longitude information. In fact, the polygons of this
particular shapefile were specified in projected meter
space. This is a bit of a problem because shapefiles do
not, generally, contain the map projection information you
need to set up a projected meter map space properly. You
have to find this map projection information elsewhere.
It is also a problem because if you wanted to set up
a projected meter map space and draw on top of it,
the normal IDL routines (i.e., Map_Continents and
Map_Grid) don't always do a very good job of that.
(And, I see evidence that the problems in this area
are being propagated into the Function Graphics map
projection routines, as well.)
Since I think most map projection programs only
make sense if you are working in projected meter
space, nearly all of my Coyote Graphics map projection
routines allow you to work in this space.
Anyway, if you are interested in why your shapefile
appears to go berserk when you open it in a shapefile
viewer that you may have obtained from someone, this
article might go a long way toward explaining the
problem. In any case, you can see how I would use
Coyote Graphics routines to solve the problem:
http://www.idlcoyote.com/map_tips/berserk.php
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|