Pseudo-Dynamic Layer

Fawcett, David David.Fawcett at STATE.MN.US
Wed Nov 2 18:57:47 PST 2005


OK, so I have the solution to my own problem...

I want to classify county polygons based on data that is not in the county shapefile.  Outside of MapServer, I query the database and derive class values (1-5) for each county.  I then build a URL that I use to build class expressions, the expression for each class contains the county ID numbers that should be assigned to that class.  

http://127.0.0.1:8080/cgi-bin/mapserv?map=/opt/fgs/www/htdocs/maps/testmap/testmap.map&mode=map&map_basemap_class_0_expression=('[COUN]'+IN+('16,25,77,11,12,13,14,15'))&map_basemap_class_1_expression=('[COUN]'+IN+('2,4,6,7,8,9,10'))&map_basemap_class_2_expression=('[COUN]'+IN+('87,86,85,84,83,82,81,80,79,78,77,76,75,74'))&map_basemap_class_3_expression=('[COUN]'+IN+('70,71'))

The mapfile layer looks like:  

LAYER

    NAME basemap

    STATUS DEFAULT

    TYPE POLYGON

    DATA 'bdry_counpy2'
    CLASSITEM "COUN"

    CLASS 
       NAME "zero"
       EXPRESSION /0/

       OUTLINECOLOR 153 153 153   

       #COLOR 196 193 161

       COLOR 255 204 205

    END
    CLASS 
       NAME "one"
       EXPRESSION /0/

       OUTLINECOLOR 255 153 153   

       #COLOR 196 193 161

       COLOR 255 153 255

    END

    CLASS 
       NAME "two"
       EXPRESSION /0/

       OUTLINECOLOR 153 153 153   

       #COLOR 196 193 161

       COLOR 255 102 255

    END
    CLASS 
       NAME "three"
       EXPRESSION /0/

       OUTLINECOLOR 153 153 153   

       #COLOR 196 193 161

       COLOR 255 0 255

    END
    CLASS 
       NAME "four"

       OUTLINECOLOR 153 153 153   

       #COLOR 196 193 161

       COLOR 255 255 255

    END


END  #end layer

I guess that it is kind of 'reverse classification'.  Kludgy as heck, but it gets me the map that I want for the demo...

David.

-----Original Message-----
From: Fawcett, David
Sent: Wed 11/2/2005 5:13 PM
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: Pseudo-Dynamic Layer
 
In MapServer CGI, is it possible to use URL parameters to pass polyID:value pairs to generate a map that classifies the indicated polys by the value passed? The geometry is stored in a shapefile. 

Obviously, one can get halfway there using Itemnquery to highlight polys. 

It is the age-old issue of having the geometry in a shapefile and wanting to classify poly by data stored somewhere else.  

I realize that this is pretty easily accomplished with a spatial database back-end, and that it is probably a pretty simple mapscript app, I am just trying to figure out if it can be done using CGI and URL values.  

Thanks, 

David.  



More information about the MapServer-users mailing list