Cartographic CSS Plugin

The gt-css module is a plugin used used to generate Style objects from a human readable CSS representation.

To use this module in your application:

Related Links:



Cartographic CSS parser

Here is an example Cartographic CSS style definition from the CSS Cookbook:

* {
   mark: symbol(circle);
   mark-size: 6px;

 :mark {
   fill: red;

The following code can be used to parse the above file and generate a GeoTools Style object:

Stylesheet ss = CssParser.parse(css);
CssTranslator translator = new CssTranslator();
Style style = translator.translate(ss);

Here is the SLD representation of the generated style:

<?xml version="1.0" encoding="UTF-8"?><sld:StyledLayerDescriptor xmlns="" xmlns:sld="" xmlns:ogc="" xmlns:gml="" version="1.0.0">
      <sld:Name>Default Styler</sld:Name>
                  <sld:CssParameter name="fill">#ff0000</sld:CssParameter>
        <sld:VendorOption name="ruleEvaluation">first</sld:VendorOption>