Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a mapfile connecting to a postgres/postgis database. To create a thematic map I can set a class item and a number of classes, for example:

CLASSITEM  "aantal"
    CLASS
        NAME "0"
        EXPRESSION ([aantal] = 0) 
        STYLE
            COLOR 116 255 117 
            OUTLINECOLOR 178 178 178
        END
    END
    CLASS
        NAME "100-250"
        EXPRESSION ([aantal] >= 1 AND [aantal] <= 2) 
        STYLE
            COLOR 0 255 0 
            OUTLINECOLOR 178 178 178
        END
    END
    CLASS
        NAME "250-500"
        EXPRESSION ([aantal] >= 3 AND [aantal] <= 10) 
        STYLE
            COLOR 0 210 0 
            OUTLINECOLOR 178 178 178
        END
    END

However I have to do this 25 times with different attributes and different values. So I would like to know whether it is possible to do this automatically.

Similar to the option in QGIS where you can set the number of classes and mode.

share|improve this question
1  
As far as I know, it is not possible. However, given the highly regular structure of the text you would have to add to the 'mapfile', you could use your preferred scripting language (Tcl, Python, Perl...) to generate this text in a separate file and, after that, copy and paste it in your 'mapfile'. –  dariapra Dec 6 '12 at 13:02
    
Thanks for your help. Unfortunately I am not familiar with any of the scripting language. Do you perhaps know another way? Or would it be easy to learn one of the languages (which one do you recommend?) –  Stefan Dec 6 '12 at 15:40
1  
Scripting language is not a must, I mean, if you are already familiar with any programming language (Java, C, C#...) use it to accomplish this task. The only extra a scripting language offers for a task like this is that you would do it faster. Another way? I don't know? Recommending a programming language? I would check out the technologies and programming languages already being used at your current workplace / industry and make a choice based on that. –  dariapra Dec 6 '12 at 15:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.