graduated color symbols and mapserver

kenboss at dilbert.dnr.state.mn.us kenboss at dilbert.dnr.state.mn.us
Tue Nov 9 09:05:54 EST 1999


List--

> I was able to solve this to some extent by using the following expressions.
> I'm not a regex guru, so some of these could sub optimal.
> 
> <Big ole' Kludge>
> 
> Suppose your range of numbers is 0-59 and you want 3 zones
> Some of these expressions overlap, but it looks like the code is written so
> the first matching expression encountered is enforced.
>
>
> Zone 1: 2 classes to handle 0-19
> [0-9]      Matches numbers from 0 to 9
> [1-1][0-9] Matches numbers from 10 to 19

If you want to match 0-9, you might try ^[0-9]$ to be on the safe side.  Plain old [0-9] might match any 
number _containing_ 0-9 (I'm not sure just how the mapserver parses these, but that would be the case in 
most regex implementations).

You can get 0-19 with ^[0,1][0-9]$.

Here are some commented examples for situations where the values you want to match are not clean, rounded 
ranges.  The examples all address a 2-digit integer field.


EXPRESSION "^[1-9]$|^[1-7]|81"          # 1-9 or anything that begins with 1-7 or 81
EXPRESSION "^8[2-9]|^9"                 # 82-89 or anything that begins with 9
EXPRESSION "^[1-9]$|^[1-4]|^7[8,9]"     # 1-9 or anything that begins with 1-4 or 78 or 79
EXPRESSION "^[5,6]|^7[1-4]|^81"         # Anything that begins with 5 or 6; 71-74 or 81
EXPRESSION "^7[5-7]"                    # 75-77
EXPRESSION "8[2-9]|9[1-5]"              # 82-89 or 91-95
EXPRESSION "12|78"                      # 12 or 78
EXPRESSION "13"                         # 13
EXPRESSION "^6$"                        # 6
EXPRESSION "71|74|75"                   # 71 or 74 or 75
EXPRESSION "^1[0-9]$"                   # 10-19
EXPRESSION "^[5,6][0-9]$|^7[0-4]"       # 50-74
EXPRESSION "^7[5-9]$|^[8,9][1-9]"       # 75-99
EXPRESSION "^1[0,1][0-9]|^12[0-4]"      # 100-124
EXPRESSION "^12[5-9]|^1[3,4][0-9]"      # 125-149
EXPRESSION "^1[5-9][0-9]|^2[0-9][0-9]"  # 150-299

Have fun!

--Ken

============================================================================
Ken Boss                                
Digital Image Analysis / Web Stuff      Forestry Resource Assessment
kenboss at dilbert.dnr.state.mn.us         Minnesota Dept. of Natural Resources
Voice: 218 327 4449 ext. 237            413 SE 13th Street                    
Fax:   218 327 4517                     Grand Rapids, MN  55744         USA
============================================================================




More information about the mapserver-users mailing list