[mapserver-users] Real life sample of a Mapfile for shp files on WMS

Fawcett, David (MPCA) David.Fawcett at state.mn.us
Mon Nov 8 17:00:16 EST 2010


Matt, 

It sounds like you have several different line layers and they are all currently being displayed in the default style (and that looks kind of crappy)...

To make your data look better, you can use classes and styles within your layers.  If you want all of the features within a layer to look the same, you just define one class within that layer.  

If you want to use different symbology based on an attribute of the data, you use multiple classes in the same layer.  Individual classes have expressions that determine which features 'fall into' that class.  

Here is an example of a line layer with only one class.  If you uncomment the first style, you 'stack' the styles and you get a colored line with an outline of a different color:

LAYER
   NAME "simple line"
   TYPE LINE
   STATUS DEFAULT
   DATA 'rail_linesln3'
    CLASS
       #STYLE
          #WIDTH 6
          #COLOR 120 120 120
       #END
       STYLE
          WIDTH 4
          COLOR 242 191 36
       END
    END
END

In this case, if you had a column in your shapefile called ROAD_TYPE, you will get different symbology depending on the value of that column for that feature:

LAYER
  NAME "my roads"
  TYPE LINE
  STATUS DEFAULT
  DATA 'roads'
  CLASSITEM "ROAD_TYPE"
  CLASS
    NAME 'Asphalt'
    EXPRESSION 'asphalt'
    STYLE
      WIDTH 6
      COLOR 212 212 212
    END
  END
  CLASS
    NAME 'Gravel'
    EXPRESSION 'gravel'
    STYLE
      WIDTH 4
      COLOR 242 191 34    
    END
  END
  CLASS
    NAME 'Other'  #any feature that doesn't match the above expressions gets caught by this class
    STYLE
      COLOR 255 51 51
      WIDTH 3
    END
  END

Does this get you started?

David.

-----Original Message-----
From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of wildcolour
Sent: Monday, November 08, 2010 3:38 PM
To: mapserver-users at lists.osgeo.org
Subject: [mapserver-users] Real life sample of a Mapfile for shp files on WMS


Hi All

I am a newbie, so sorry if it seems like I have no idea (it is probably
because I really do have no idea).

We have got mapserver up and running, and the WMS is working fine. I have
read through the documentation, but I am lost without an more detailed
example of a mapfile.

I have about 6 shp files. Each file has different features that I want to
make into different WMS layers.  The data is for a topographical map.  For
example a file contains roads, power-lines and walking tracks.  Each type of
road, power-line etc have different tags (some also have the name of the
road after a comma). I am assuming this is fairly normal so far.

What I want to be able to do is apply a different class (not sure this is
the right term) to the roads, the power-lines and the walking tracks.  Looks
like I need to do some kind of query in the map file. At this stage we have
only each file acting as layer.

Does anyone have an example mapfile (that splits a SHP file into different
layers) that they would be happy to send?  I am fairly confident the penny
will drop for me if I can see a working example.

Thanks

Matt  :)
-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Real-life-sample-of-a-Mapfile-for-shp-files-on-WMS-tp5718787p5718787.html
Sent from the Mapserver - User mailing list archive at Nabble.com.
_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users




More information about the mapserver-users mailing list