One shapefile, many countries, many colors?

percy percyd at PDX.EDU
Thu Jun 14 21:56:24 PDT 2007


You can also use an open source tool like Quantum GIS (qgis.org) to 
generate random colors like you are used to in Arc, then export the 
mapfile from QGIS and copy just the class expressions into your own 
mapfile that you've already been working with.

You might need to tweak the expression syntax to work with PostGIS 
(depending on whether you point QGIS at a shapefile or a postgis table), 
but this can still save a lot of hand coding of classes.
Percy

Pascal Ehlert wrote:
> That's great, thank you for the example.. Makes it a lot clearer :)
>> As an example I am usually using something similar like this:
>>
>> LAYER
>>     NAME "Countries"   
>>     GROUP "Africa"
>>      TYPE POLYGON
>>     STATUS ON
>>   CONNECTIONTYPE postgis
>>   CONNECTION "user=me password=none dbname=africa host=localhost"
>>   DATA "the_geom from (select the_geom, countryname, area, gid from
>> africa_countries) as temp using unique gid using SRID=4326"
>>   # SRID 4326 is when using decimal degrees, replace with the correct 
>> SRID
>> for your data    CLASSITEM "countryname"   
>>      CLASS
>>          NAME "EGYPT"
>>          COLOR 153 204 143
>>          EXPRESSION ([countryname]=EGYPT)
>>      END
>>      CLASS
>>          NAME "LYBIA"
>>          COLOR 252 141 50
>>          EXPRESSION ([countryname]=LYBIA)
>>      END
>>      CLASS
>>          NAME "MADAGASCAR"
>>          COLOR 255 190 232
>>          EXPRESSION ([countryname]=MADAGASCAR)
>>      END   
>> END
>>
>> Cheers
>> Karsten
>>
>>   
>

-- 
David Percy
Geospatial Data Manager
Geology Department
Portland State University
http://gisgeek.pdx.edu
503-725-3373



More information about the MapServer-users mailing list