[Mapserver-users] SQL Data

Homme Zwaagstra hrz at geodata.soton.ac.uk
Fri May 28 04:48:35 EDT 2004

On Thu, May 27, 2004 at 02:38:51PM -0700, Eric Katherman wrote:
> Okay... I have the basics of working with MS and PHP down to the point I can 
> turn layers on and off as well as zoom in and out.  I now need to know how I 
> can take data from the dbf file and based on it's value display it 
> differently then other records in the same dbf file... 

It sounds like you're trying to filter your data. Rather than try to
do this on the data side in php, I would use mapserver's inbuilt
filtering functions which I've found to be powerful enough for most

> Scenario:
> I have a table that draws centerlines of streets and contains the street 
> names.  I can get the street names to display using labels and such but would 
> like to control the display of the classification of streets. (e.g. major 
> streets are B, minor are C, smaller then that are D etc...)  How can I 
> display the B streets when I am zoomed out closer to the extents and then 
> display C and D when I zoom in?   

You can avoid any scripting by specifying each street type as a
separate layer in the mapfile and using the MINSCALE / MAXSCALE
attributes to control the visibility.

If you wanted to keep everything in one layer, you could specify
separate classes for each street type and then use mapscript to
dynamically alter the layer's FILTER attribute at different scales to
only select specific data.

> Is there a way to dump the data from this dbf file into a temporary table in 
> MySQL and then query the DB to get that data back?

I don't know of any off the shelf tool to do this but I imagine you
could script this yourself; I know there are DBF
and MySQL modules for perl and python for instance.

Kind regards,

Homme Zwaagstra

More information about the mapserver-users mailing list