Classes in a Layer obstructing each other (I don't think they should be)

Fawcett, David David.Fawcett at STATE.MN.US
Wed Oct 24 19:06:12 PDT 2007


Matt, 

I believe that only the first class that matches the expression gets used.  I think that to get the borders, you might want to create a second scale-dependent layer that does the outlines.  

That would be the cleanest way to do it. I am not sure about the order of evaulation for expression and maxscale.  If MapServer looks at maxscale first, you could have two classes with the same expression, but with mutually exclusive min/max scales.  One could have the fill plus the outline and one could have just the fill.  My guess is that the expression gets higher priority and that this second case wouldn't work.  There are a lot of people who could confirm or deny this, I am just not one of them...

David. 


-----Original Message-----
From: UMN MapServer Users List on behalf of Matt Pettis
Sent: Wed 10/24/2007 8:00 PM
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: [UMN_MAPSERVER-USERS] Classes in a Layer obstructing each other (I don't think they should be)
 
Hi,

I'm trying to render a layer that colors polygons.  Three of the classes are used to color the polygon, and they are mutually exclusive classes (i.e., only one class at a time will be applicable to a given polygon).  The fourth class I have is meant to draw an outline of the polygon at a certain maxscale value, otherwise, do not display a border.

What I am getting is that the 'border' class doesn't work with the other three.  If it is the first class in the layer, it totally obstructs the results of the other three (even though I am making this layer transparent and the style of the class have a color of -1 -1 -1).  If it is the last class, the borders do not show up at all at any scale.  Any advice or clarification on my misunderstanding of how Mapserver is operating would be appreciated.  Below is the relevant layer:

-----------
LAYER
  NAME              "Precincts"
  CONNECTIONTYPE    postgis
  CONNECTION        "user=postgres dbname=postgis password=xxxx"
  DATA              "the_geom from (select distinct on (county_id, prct_id) county_name , prct_name , candidate_name , party_abbr , percentage_of_votes_for_candidate_by_office , the_geom from ( select distinct on (county_id, prct_id) county_id , prct_id , office_name , max(votes_for_candidate) as votes_for_candidate from sos_stateracespct where office_name = 'US SENATOR' group by county_id , prct_id , office_name having max(votes_for_candidate) > 0 ) m inner join sos_stateracespct using (county_id, prct_id, office_name, votes_for_candidate) inner join shp_prct using (county_id, prct_id) inner join sos_coprct_f using (county_id, prct_id)) as foo using unique the_geom using SRID=-1"
  STATUS            on
  TYPE              polygon
  TRANSPARENCY      0

  CLASS
    NAME            "Draw Prct Boundaries"
    MAXSCALE          500000
    STYLE
      OUTLINECOLOR  0 0 0
      COLOR         -1 -1 -1
      WIDTH         1
    END
  END

  CLASS
    NAME            "DFL Votes"
    EXPRESSION      ("[party_abbr]" = 'DFL' AND [percentage_of_votes_for_candidate_by_office] > 0.5)
    COLOR           153 204 255
  END

  CLASS
    NAME            "R Votes"
    EXPRESSION      ("[party_abbr]" = 'R' AND [percentage_of_votes_for_candidate_by_office] > 0.5)
    COLOR           255 153 255
  END

  CLASS
    NAME            "No Clear Majority"
    EXPRESSION      ( !("[party_abbr]" = 'R' and [percentage_of_votes_for_candidate_by_office] > 0.5) and !("[party_abbr]" = 'DFL' and [percentage_of_votes_for_candidate_by_office] > 0.5))
    COLOR           255 255 153
  END

END



More information about the MapServer-users mailing list