Problems? Is your data what you think it is? | |
PerlMonks |
Re: Generating a map using perlby Anonymous Monk |
on Apr 30, 2002 at 21:25 UTC ( [id://163169]=note: print w/replies, xml ) | Need Help?? |
The fedtstats.gov/thememaps example previously mentioned is your best direct example, since they're doing the same thing, with publicly available data: TIGER. Since they're a federal project, they might even be able to release their code. See the module Geo::TigerLine for how to handle (and get) the county border data. Although you can get county outlines as lat-long point pairs from other sources, TIGER is the new standard.
My Perl generated state maps aren't area maps (yet), only point-plots from a flat-file database. I used GD.pm with basemaps from Color Landform Atlas by permission. My maps are online at EMAARES (points) (and with lines too). For those plotting points and wanting nice state basemaps see Sterner's Color Landform Atlas of the States <A HREF="http://fermi.jhuapl.edu/states/about.html#use">Rights and terms of use</A> and Birrell's tesselation of Sterner's mark 1 <A HREF="http://birrell.org/andrew/copyright.html">Rights and use</A> for the source of my basemaps. My other dataset is, like yours, weather related, although specifically related to radio propagation, and prognostic & diagnostic rather than climatalogical; I'm currently working from soundings, so also a point-plot situation. When I get it rich enough to be worth plotting areas instead of point values (from model grid fields), it will be contoured and not thematic (county based). For that one, I'm currently using as basemaps a radar plot, Sterner's B&w states, and Birrell's tiling of Sterner's previous maps. For Thematic work, GD.pm should be adequate. GD.pm has a limitation of 256 colors, a bit awkward with detailed basemaps, but that's enough for thematic work. Recent versions of GD.pm support PNG and JPEG, older versions support GIF and JPEG. For thematic, you'd probably prefer PNG. GD.pm can overlay data onto a basemap read from disk, or generate the whole map, on the fly in a CGI or mod_perl module just fine, as it can write the resulting PNG to STDOUT if instructed to do so. (Just be sure to provide the HTTP header first, and binmode if on WIntel. ActiveState has GD.pm.) I'd recommend saving the basemap(s) and overlaying data on the fly, as the state outlines are often large and nasty chains, while county outlines are more often internally simple -- but your state and server situation may vary, generating the whole thing on the fly may be logical for you. And as the fedstat Monk said, if there are few enough variants, pre-generating them all to disk trades space for time. bill -- n1vux at arrl.net
In Section
Seekers of Perl Wisdom
|
|