.. _example1-2: =========== Example 1.2 =========== Static Map with Two Layers -------------------------- .. image:: http://demo.mapserver.org/cgi-bin/mapserv?map=/osgeo/mapserver/tutorial/htdocs/example1-2.map&layer=states_poly&layer=states_line&mode=map As in the first example, this image was generated by linking the source of the <img> tag to this URL: `<http://demo.mapserver.org/cgi-bin/mapserv?map=/osgeo/mapserver/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: :ref:`Example1-2.map <example1-2-map>` MapFile Structure ################# The mapfile structure, by objects, looks like this: :: MAP LAYER-|-LAYER CLASS-| |-CLASS STYLE-| |-STYLE</pre> Here we split the original layer into two layers. The first layer is still a polygon layer but the :ref:`STYLE object <style>` no longer has OUTLINECOLOR, such as: .. code-block:: mapfile LAYER ... TYPE POLYGON ... CLASS NAME "States" STYLE COLOR 232 232 232 END END END 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. .. code-block:: mapfile LAYER ... TYPE LINE CLASS NAME "State Boundary" STYLE COLOR 32 32 32 END END END 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. ---- :ref:`Back to Example 1.1 <example1-1>` | :ref:`Proceed to Example 1.3 <example1-3>` ----