Example 1.2: Static Map with Two Layers
As in the first example, this image was generated by linking the source of the <img> tag to this URL: http://terrasip.gis.umn.edu/cgi-bin/mapserv.exe?map=/ms4w/apps/tutorial/htdocs/example1-2.map &layer=states_poly&layer=states_line&mode=map . This is how most of the examples in this section work.
Anyway, you'll notice that the map here is the same as the first example. Yes, but the mapfile is different. Have a look.
This is what the mapfile looks like (Example1-2.map):
The mapfile structure, by objects, looks like this:
MAP LAYER-|-LAYER CLASS-| |-CLASS STYLE-| |-STYLE
Here we split the original layer into two layers. The first layer is still a polygon layer but the STYLE no longer has OUTLINECOLOR. The second layer is similar to the first except that the TYPE is changed to LINE and the COLOR in the STYLE is changed to the same color as the OUTLINECOLOR in the first example. This produces the same image as the first one... So, why do it this way? If we continue to add layers on top of the states layer, the outline will most likely be covered up by these other layers. To still see the state boundaries after we add these other layers, we have to separate the states boundary line layer from the states polygon layer and put it on top of the other other layers. There is order in how we define/add layers and you'll see it clearly as we proceed in this section.