Book Image

GeoServer Cookbook

By : Stefano Iacovella
Book Image

GeoServer Cookbook

By: Stefano Iacovella

Overview of this book

Table of Contents (17 chapters)
GeoServer Cookbook
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a simple polygon style with CSS


We're assuming that you already know how to make WMS GetMap requests to GeoServer and you have already played with simple SLD styles. Now, you'll start creating your first simple style using the CSS syntax. For this recipe, you'll use the countries feature type you published in Chapter 1, Working with Vectors.

Tip

The entire CSS style for the recipe is located in the GeneralizedCountries.css file.

How to do it…

  1. Open the CSS Style section from the GeoServer web interface. Then, select the link Choose a different layer. From the list of layers, select PostGISLocal:GeneralizedCountries.

  2. Select the Create a new style link. In the form, select the NaturalEarth workspace and insert the style name, as shown in the following screenshot:

  3. GeoServer inserts a short template for you:

    * { fill: lightgrey; }
  4. Replace the code in the textbox with the following rules:

    * {
      fill: #8FBC8F;
      fill-opacity: 0.7;
    }
    * {
      stroke: #000000;
      stroke-opacity: 0.7;
    }
  5. Press the Submit...