[Mapserver-users] Creating classes with data from a mysql database

Alexandros Chimarios alhim at intracom.gr
Thu Apr 29 23:04:02 PDT 2004


First of all, you should select the columns you wish to appear in the 
CLASSITEM and EXPRESSION in your data fiels like this :

DATA " geolocation from (SELECT unit_tracks.geolocation, unit_tracks.unit_id 
,units.name , units.identification from unit_tracks LEFT JOIN units ON 
unit_tracks.unit_id = units.unit_id) as foo using unique unit_id using 
srid=-1  "

Then you set the EXPRESSION and CLASSITEM :

		..........
CLASSITEM "identification"
                   
        CLASS
            
            EXPRESSION "UNKNOWN"	

 			.......

Hope this example helps. Please notice that no DB table expression are set in 
CLASSITEM. If i put "CLASSITEM 'units.identification'   "   then I will get 
an error. Once the data have been imported from the DB, MapServer treats them 
as its own table. 

Alexandros


On Friday 30 April 2004 05:26, Attri, Abhishek wrote:
> Hi All,
>
>
>
> I need to create classes on a map object based on data fetched from a
> MySQL database. The classes will be created and displayed based on the
> attributes in the MySQL table (These are not shapefiles). My confusion
> is what will go in the 'data' and 'classitem' fields of the layer
> object, and also how will I set an expression in the class based on
> MySQL table attributes.
>
>
>
> Any examples?
>
>
>
> With thanks in advance....
>
>
>
> Abhishek




More information about the MapServer-users mailing list