Creating shaded zip code maps (newbie)
Bill Binko
bill at BINKO.NET
Mon May 16 15:03:48 PDT 2005
On Mon, 16 May 2005, Steve Gertz wrote:
> I'm tring to create a highlighted view zip codes, based on the number of
> ad impressions we have for each zip code. I'd want to do some number
> crunching and shade each zip code (or other geographical shape) between
> white and some solid (with gray for no data).
this is very doable. The most recent CVS has some added features for
this, but even out of the box 4.4 can do this for you.
>
> I've got the 5 digit Zip code tablulation areas from the census. From
> there things get more tricky. I think I want a raster image for each
> scale of the map, but I can't find any interfaces that allow making the
> raster files easy in perl. I can't seem to find anything that will link
> the raster and geographic data together.
Your easiest solution would be to use ESRI Shapefiles for the zipcodes.
Once you have those (they are vector datasets), you can link in your data
via several methods (mapscript or postGIS come to mind).
> Does anyone have advice for solving this type of problem? Seems this
> would be a great FAQ to add to the mapserver / gdal / grass / et al
> websites.
I have recently done exactly this with census blocks recently. Here's the
process I took:
1) Got the census block shapefiles (from FGDL.org in my case since I just
needed florida). You'd need zipcode shapefiles (they're available)
2) Loaded the files into postGIS using shp2pgsql (making sure I set the
SRID right).
3) Setup my other data (traffic counts from BTS) in another Postgresql
table indexed by census block id
4) Added a layer to my map that used PostGIS and performed the query and
join that I wanted.
5) Created Styles/Classes that displayed the ranges I wanted based on the
attributes I joined to. I used the Gradient/ColorRange code I
contributed, but it isn't needed: you can just define classes for each
range of data that you want a different color (0.0->0.25, 0.25->0.5, etc)
Once I had exactly what I wanted, I actually exported the things that were
static back out to shapefiles using pgsql2shp. This let my static stuff
be loaded faster.
This is very doable, and in fact, it is incredible what you can do with
just these tools. I'm sure those with more experience can give you better
paths to take, but this one works for me.
Bill
More information about the MapServer-users
mailing list