In this chapter, we cover the following recipes:
Maps are a powerful representation of data. To produce a beautiful map, very often, you need to use a lot of symbols. For instance, dashing lines for roads under construction, lines with hatching for railroads, appropriate filling for swamps, and points for caves and mines. A map can contain dozens of different symbols; it's your way of expressing your idea of a part of the world to other people.
A standard way to produce maps with GeoServer is using WMS configured with appropriate styles.
WMS lets you define styles with Styled Layer Descriptor (SLD); see http://en.wikipedia.org/wiki/Styled_Layer_Descriptor.
While SLD is a powerful tool and enables you to create complex and pretty rendering of data, it is also famous for being quite hard to write and understand for humans.
Cascading Style Sheets (CSS) (see http://en.wikipedia.org/wiki/CSS) is a convenient and easier replacement alternative to long SLD documents. When using CSS, you must be aware that this is GeoServer specific.
While SLD is a standard approach that can be reused with other WMS implementations or a desktop application such as QGIS, CSS is a GeoServer-specific module. For instance, you can't use the CSS syntax with MapServer, but you can, of course, reuse the styles on another GeoServer WMS server, assuming that layers with similar details are published on them.
Indeed, the CSS module does not really replace SLD. The CSS syntax is used to generate the SLD styles and these are saved in that format in the GeoServer data directory. When a map is produced, GeoServer uses the SLD files to render maps, not the CSS ones.
The CSS module basically lets you use a simple human-readable syntax to quickly create drawing rules, taking care of translating your ideas into the XML format according to the SLD standard.
CSS styles can easily be read by humans and are easy to use and modify with a simple text editor. SLD styles are generated for use by the WMS rendering engine.
3.135.213.212