Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been given some shp files to be displayed using Mapserver. Until now I was able to find the correct projections, display the map, and show labels. However, I have problems with polygon colors. When I set COLOR to any value, the entire map is filled with that color.

Is it a problem with the shp file, or what am I doing wrong? For example:

LAYER
    NAME mylayer
    TYPE POLYGON    
    DATA "mylayer.shp"
    STATUS DEFAULT
    CLASS
      NAME mylayer

      STYLE
        COLOR 255 0 0
        OUTLINECOLOR 0 0 0
      END
    END
  END 

This will fill the entire map with red color, polygons have black outline.

Help! :)

share|improve this question
    
Do the full map get orange if you change COLOR to 255 173 15? – simo Feb 22 '11 at 14:28
    
Yes, it turns all orange with black polygon outlines. – Palantir Feb 22 '11 at 14:33
2  
Have you checked the polygon file in some desktop GIS? Maybe there is one big polygon. – underdark Feb 22 '11 at 14:37
2  
donut polygons or multi-part polygons in your shapefile? – Mapperz Feb 22 '11 at 14:55
1  
Often with parcels, you will have contiguous polygons that cover an entire area. If there are individual polygons for the buildings and there is a code to indicate which polys represent buildings, you can use an expression in your MapServer layer class to symbolize the buildings in a specific way. Can you post a small data sample anywhere? – DavidF Feb 23 '11 at 16:11

In your layer config you have one class (and one colour), so you are telling MapServer to render all polygons with one colour.

If you want to have diffent coloured polygons you need to specify more than one class (each with a different colour).

So you need to find the coloumn in your mylayer.shp that holds information you want to classify (colour) your map on; for example it could be be called landuse, then for each unique value of that column that you want to show you need your own CLASS, so your config file might end up looking like:

LAYER
  NAME mylayer
  TYPE POLYGON    
  DATA "mylayer.shp"
  STATUS DEFAULT

  CLASSITEM "landuse"

  CLASS
    NAME "big building"
    STYLE
      COLOR 255 0 0
      OUTLINECOLOR 0 0 0
    END
  END

  CLASS
    NAME "small building"
    STYLE
      COLOR 0 255 0 
      OUTLINECOLOR 0 0 0
    END
  END

  CLASS
    NAME "no building"
    STYLE
      COLOR 0 0 255
      OUTLINECOLOR 0 0 0
    END
  END

END 
share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.