[Mapserver-users] Coloring shapefile layer according to DB query

Matthew Haines mhaines94108 at hotmail.com
Fri Oct 10 15:20:18 EDT 2003


I have a shapefile for the tax lots in Manhattan (New York City) and I have 
a lot of information about the individual tax lots in a MySQL database.  I 
would like to generate maps where I color the tax lots according to the data 
in the MySQL database.

Just as an example, I have a table that tells me how many residential units 
have been built on a particular tax lot.  I might like to color the map by 
population density so that single family dwellings are light red, 2-4 family 
buildings are medium red, and 5+ family apartment buildings are dark red.

Is there any way to do this without loading the shapefile polygons into the 
database?  I've had several thoughts, but they seem impractical ...

=> I could use Perl MapScript to write a program that would scan the entire 
database table and assign tax lots to different layers ... but there are 
100,000 tax lots in Manhattan and that might take a long time.

=> I could try to get put the data into the shapefile ... but how?  I don't 
have any commercial mapping software for working with shapefiles.  Is there 
a utility to do this?  Also that makes my data hard to update.

=> Is there a MAP file command to load data from a database and somehow join 
it to the shapefile on the fly so I can define layers based on it?

I'm hesitant to mess with MySQL, if only for fear of breaking my existing 
applications.  The documentation indicates that the MySQL connector is 
buggy.

What's the best way to go about this?  Do I have to install PostgreSQL?

Pointers much appreciated,

Matthew

Matthew

_________________________________________________________________
Share your photos without swamping your Inbox.  Get Hotmail Extra Storage 
today! http://join.msn.com/?PAGE=features/es




More information about the mapserver-users mailing list