Creating Stunning Maps in GeoServer: mastering SLD and CSS styles

GeoSolutions
GeoSolutionsFounder & Director at GeoSolutions S.A.S.
Creating stunning maps
with GeoServer
Mastering SLD and CSS
Ing. Andrea Aime
GeoSolutions
GeoSolutions
 Founded in Italy in late 2006
 Expertise
• Image Processing, GeoSpatial Data Fusion
• Java, Java Enterprise, C++, Python
• JPEG2000, JPIP, Advanced 2D visualization
 Supporting/Developing FOSS4G projects
 GeoServer, MapStore
 GeoNetwork, GeoNode, Ckan
 Clients
 Public Agencies
 Private Companies
 http://www.geo-solutions.it
FOSS4G 2017, Boston
August 14th-19th 2017
SLD vs CSS
 Styled Layer Descriptor
 OGC standard
 XML based, verbose, hard to hand edit
 Only showing relevant bits of the SLD
 GeoCSS
 CSS with extensions for map rendering
 Simple, Compact, designed for human beings
 Not a standard (several incompatible variants for
mapping, GeoServer one has nothing to do with
CartoDB/MapBox one)
FOSS4G 2017, Boston
August 14th-19th 2017
CSS features
 Familiar for web developers
 Compact syntax
 Symbolization triggered by “key” properties
(stroke, fill, mark, label, channel-selection)
 CQL based filtering
 Cascading keeps complex styling compact (you
just express the overrides to the base)
 Interactive editor for productive style
development
FOSS4G 2017, Boston
August 14th-19th 2017
GeoCSS in a nutshell
• Filter by attribute/env variable in CQL
• Filter by scale
• Set properties to control symbolization
• Key properties activate certain symbolization:
– mark/fill/stroke/label/raster-channels
FOSS4G 2017, Boston
August 14th-19th 2017
[admin_level < 2][@sd < 1M][@sd > 100k] {
label: name;
font-family: ‘Noto Sans’;
…
/* this is nested rule */
[special = true][@sd < 500k] {
font-weight: bold;
…
}
}
SLD equivalents
FOSS4G 2017, Boston
August 14th-19th 2017
<sld:Rule>
<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>admin_level</ogc:PropertyName>
<ogc:Literal>2</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
<sld:MinScaleDenominator>100000</sld:MinScaleDenominator>
<sld:MaxScaleDenominator>1000000</sld:MaxScaleDenominator>
<sld:TextSymbolizer>
<sld:Label>
<ogc:PropertyName>name</ogc:PropertyName>
</sld:Label>
<sld:Font>
<sld:CssParameter name="font-family">
Noto Sans
</sld:CssParameter>
<sld:CssParameter name="font-size">10
...
</sld:TextSymbolizer>
<!–- Override would require a separate rule specifying everything again -->
</sld:Rule>
Filter
Scale
dependency
Symbolizers
and their
properties
Scale dependencies
FOSS4G 2017, Boston
August 14th-19th 2017
Types of Scale dependency
 Decide whether to symbolize based on the scale or not
 E.g., at lower scales/lower zoom levels do not show buildings
 Symbolize in a different way depending on the scale
 E.g., different thickness based on the current zoom
FOSS4G 2017, Boston
August 14th-19th 2017
Expressing scale dependency filters
 SLD:
 <MinScaleDenominator>
 <MaxScaleDenominator>
 CSS
 Legacy: [@scale > 10000000]
 GeoServer 2.12+: [@sd > 1M]
 More compact variable, more correct (it’s a scale
denominator, not a scale!)
 Compact expression of large numbers makes them readable
at a glance, e.g., 100k, 1M
FOSS4G 2017, Boston
August 14th-19th 2017
Unit of Measure
FOSS4G 2017, Boston
August 14th-19th 2017
 Useful if you have real world measures of line
thicknesses and the like
<LineSymbolizer uom="http://www.opengeospatial.org/se/units/metre">
<Stroke>
<CssParameter name="stroke">#0000FF</CssParameter>
<CssParameter name="stroke-width">5</CssParameter>
</Stroke>
</LineSymbolizer>
* {
stroke: blue;
stroke-width: 5m;
}
Transformation functions
FOSS4G 2017, Boston
August 14th-19th 2017
 OSM like, setting a different value depending on
the current scale/zoom level
 Not a linear scale mind
[class = 'highway’
and type in ('motorway’,
'motorway_link’)]
[@sd < 25M] {
stroke: #e66e89;
stroke-width: categorize(@sd,
2, 400k,
1.9, 800k,
1.4, 1.5M,
1, 3M,
0.8, 6M,
0.5);
…
 Less than 400k  2px
 [400k, 800k]  1.9px
 [800k, 1.5M]  1.4px
 [1.5M, 3M]  1
 [3M, 6M]  0.8
 Above 6M -> 0.5
Transformation functions in SLD
FOSS4G 2017, Boston
August 14th-19th 2017
<sld:LineSymbolizer>
<sld:Stroke>
<sld:CssParameter name="stroke">#e66e89</sld:CssParameter>
<sld:CssParameter name="stroke-width">
<ogc:Function name="Categorize">
<ogc:Function name="env">
<ogc:Literal>wms_scale_denominator</ogc:Literal>
</ogc:Function>
<ogc:Literal>2</ogc:Literal>
<ogc:Literal>400000</ogc:Literal>
<ogc:Literal>1.9</ogc:Literal>
<ogc:Literal>800000</ogc:Literal>
<ogc:Literal>1.4</ogc:Literal>
<ogc:Literal>1500000</ogc:Literal>
<ogc:Literal>1</ogc:Literal>
<ogc:Literal>3000000</ogc:Literal>
<ogc:Literal>0.8</ogc:Literal>
<ogc:Literal>6000000</ogc:Literal>
<ogc:Literal>0.5</ogc:Literal>
</ogc:Function>
</sld:CssParameter>
</sld:Stroke>
</sld:LineSymbolizer>
Point styling
FOSS4G 2017, Boston
August 14th-19th 2017
Simple symbol
FOSS4G 2017, Boston
August 14th-19th 2017
[type = 'alpine_hut'][@sd < 100k] {
mark: url('symbols/alpinehut.p.16.png');
}
<sld:Rule>
<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>alpine_hut</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
<sld:MaxScaleDenominator>100000.0</sld:MaxScaleDenominator>
<sld:PointSymbolizer>
<sld:Graphic>
<sld:ExternalGraphic>
<sld:OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:type="simple"
xlink:href="symbols/alpinehut.p.16.png"/>
<sld:Format>image/png</sld:Format>
</sld:ExternalGraphic>
</sld:Graphic>
</sld:PointSymbolizer>
</sld:Rule>
Marks (SVG in this case)
FOSS4G 2017, Boston
August 14th-19th 2017
[type = 'bank'][@sd < 6k] {
mark: symbol('file://symbols/bank.svg');
:mark { fill: #734a08 };
mark-size: 14;
}
<sld:Rule>
<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>bank</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
<sld:MaxScaleDenominator>6000.0</sld:MaxScaleDenominator>
<sld:PointSymbolizer>
<sld:Graphic>
<sld:Mark>
<sld:WellKnownName>file://symbols/bank.svg</sld:WellKnownName>
<sld:Fill>
<sld:CssParameter name="fill">#734a08</sld:CssParameter>
</sld:Fill>
</sld:Mark>
<sld:Size>14</sld:Size>
</sld:Graphic>
</sld:PointSymbolizer>
</sld:Rule>
New in
GeoServer
2.12!
Marks composition and override
FOSS4G 2017, Boston
August 14th-19th 2017
[type = 'fountain'][@sd < 6k] {
mark: symbol(circle), symbol(circle);
:nth-mark(1) { fill: #b5d0d0 };
:nth-mark(2) { fill: #576ddf };
mark-size: 10, 3;
[@sd < 3k] {
mark: symbol('file://symbols/fountain.svg');
:mark { fill: #576ddf; };
}
}
 Many other options!
 Built-in symbol names (well known marks): circle,
square, triangle, …
 From TTF fonts using the name
ttf://<fontname>#charcode
 Windbarbs, e.g.:
windbarbs://default(15)[kts]
 WKT specification, e.g.
wkt://MULTILINESTRING((-0.25 -0.25, -0.125 -0.25), (0.125 -
0.25, 0.25 -0.25), (-0.25 0.25, -0.125 0.25), (0.125 0.25, 0.25
0.25))
 See more here:
http://docs.geoserver.org/latest/en/user/styling/sld/exte
nsions/pointsymbols.html
Other mark options
FOSS4G 2017, Boston
August 14th-19th 2017
Filling polygons
FOSS4G 2017, Boston
August 14th-19th 2017
Solid filling
FOSS4G 2017, Boston
August 14th-19th 2017
* {
fill: lightgrey;
stroke: black;
stroke-width: 0.5;
}
<sld:PolygonSymbolizer>
<sld:Fill>
<sld:CssParameter name="fill">#d3d3d3</sld:CssParameter>
</sld:Fill>
<sld:Stroke>
<sld:CssParameter name="stroke-width">0.5</sld:CssParameter>
</sld:Stroke>
</sld:PolygonSymbolizer>
Filling with repeating images
fill
FOSS4G 2017, Boston
August 14th-19th 2017
[@sd < 800k][type in ('cemetery', 'grave_yard')] {
fill: #aacbaf;
[@sd < 50k] {
[religion = 'jewish'] {
fill: #aacbaf, url('symbols/grave_yard_jewish.png');
};
[religion = 'christian'] {
fill: #aacbaf, url('symbols/grave_yard_christian.png');
};
[religion = 'INT-generic'] {
fill: #aacbaf, url('symbols/grave_yard_generic.png');
};
};
}
Filling with repeating images (SLD)
FOSS4G 2017, Boston
August 14th-19th 2017
<sld:Rule>
<ogc:Filter>
<ogc:And>
<ogc:Or>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>cemetery</ogc:Literal>
</ogc:PropertyIsEqualTo>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>grave_yard</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Or>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>religion</ogc:PropertyName>
<ogc:Literal>jewish</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:And>
</ogc:Filter>
<sld:MaxScaleDenominator>50000.0</sld:MaxScaleDenominator>
One sample rule (the Jewish religion one).
Three more needed to get the same
display as with CSS
Filling with repeating images (SLD)
FOSS4G 2017, Boston
August 14th-19th 2017
<sld:PolygonSymbolizer>
<sld:Fill>
<sld:CssParameter name="fill">#aacbaf</sld:CssParameter>
</sld:Fill>
</sld:PolygonSymbolizer>
<sld:PolygonSymbolizer>
<sld:Fill>
<sld:GraphicFill>
<sld:Graphic>
<sld:ExternalGraphic>
<sld:OnlineResource
xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:type="simple"
xlink:href="symbols/grave_yard_jewish.png" />
<sld:Format>image/png</sld:Format>
</sld:ExternalGraphic>
</sld:Graphic>
</sld:GraphicFill>
</sld:Fill>
</sld:PolygonSymbolizer>
</sld:Rule>
Filling with marks
FOSS4G 2017, Boston
August 14th-19th 2017
<sld:PolygonSymbolizer>
<sld:Fill>
<sld:GraphicFill>
<sld:Graphic>
<sld:Mark>
<sld:WellKnownName>shape://times</sld:WellKnownName>
<sld:Stroke>
<sld:CssParameter name="stroke">#ADD8E6</sld:CssParameter>
</sld:Stroke>
</sld:Mark>
<sld:Size>8</sld:Size>
</sld:Graphic>
</sld:GraphicFill>
</sld:Fill>
</sld:PolygonSymbolizer>
</sld:Rule>
[@scale < 10000] {
fill: symbol('shape://times');
fill-size: 8;
:fill {
stroke: #ADD8E6;
}
}
Painting lines
FOSS4G 2017, Boston
August 14th-19th 2017
Solid lines (OSM admin borders)
FOSS4G 2017, Boston
August 14th-19th 2017
[type = 'administrative'] {
[admin_level <= 4],
[admin_level = 5 or admin_level = 6][@sd <= 400k],
[admin_level = 7 or admin_level = 8][@sd <= 200k],
[admin_level = 9 or admin_level = 10][@sd <= 100k] {
stroke: #ac46ac;
stroke-opacity: 0.4;
}
}
<!-- 5 different rules with different filters followed by this -->
<sld:LineSymbolizer>
<sld:Stroke>
<sld:CssParameter name="stroke">#ac46ac</sld:CssParameter>
<sld:CssParameter name="stroke-opacity">0.4</sld:CssParameter>
</sld:Stroke>
</sld:LineSymbolizer>
Dashes
FOSS4G 2017, Boston
August 14th-19th 2017
…
<sld:LineSymbolizer>
<sld:Stroke>
<sld:CssParameter name="stroke">#6B4900</sld:CssParameter>
<sld:CssParameter name="stroke-width">0.1</sld:CssParameter>
<sld:CssParameter name="stroke-dasharray">2 2</sld:CssParameter>
</sld:Stroke>
</sld:LineSymbolizer>
[@sd < 75k] {
stroke: #6B4900;
stroke-width: 0.1;
stroke-dasharray: 2;
}
Alternating dashes with marks
FOSS4G 2017, Boston
August 14th-19th 2017
* {
stroke: darkRed, symbol('circle');
stroke-dasharray: 10 14, 6 18;
stroke-dashoffset: 14, 0;
:stroke {
fill: darkRed;
size: 6;
}
}
 Two coordinated dashed lines
 One made with lines
 One made with circles
 The offset shifts them to have
one appear in the empty
spaces of the other
Labeling
FOSS4G 2017, Boston
August 14th-19th 2017
Vendor options
FOSS4G 2017, Boston
August 14th-19th 2017
Point labels and obstacles
FOSS4G 2017, Boston
August 14th-19th 2017
[@sd < 200k] {
label: [FULLNAME];
label-anchor: 0.5 1.0;
label-offset: 0.0 -14.0;
font-fill: #000033;
font-family: Arial;
font-size: 12;
halo-color: white;
halo-radius: 1.5;
label-priority: 200000;
label-auto-wrap: 100;
mark: url('./img/landmarks/${IMAGE}’);
mark-label-obstacle: true;
}
«FULLNAME»
attribute
Auto wrapping
label with halo.
Data driven
symbol URLLabels won’t overlap
the symbol
Line labels
FOSS4G 2017, Boston
August 14th-19th 2017
[@sd < 200k] {
label: [LABEL_NAME];
font-fill: #000000;
font-family: Arial;
font-size: 13;
font-style: normal;
font-weight: bold;
halo-color: #FFFFFF;
halo-radius: 1;
label-follow-line: true;
label-repeat: 400;
label-group: true;
label-max-displacement: 200;
}
Draw «LABEL_NAME»,
black, with white halo
Draw them along lines,
fuse segments with
same label, repeat
Polygon labels
FOSS4G 2017, Boston
August 14th-19th 2017
<sld:TextSymbolizer>
<sld:Label>
<ogc:PropertyName>FULLNAME</ogc:PropertyName>
</sld:Label>
<sld:Font>
<sld:CssParameter name="font-family">Arial</sld:CssParameter>
<sld:CssParameter name="font-size">14.0</sld:CssParameter>
<sld:CssParameter name="font-weight">bold</sld:CssParameter>
</sld:Font>
<sld:LabelPlacement>
<sld:PointPlacement>
<sld:AnchorPoint>
<sld:AnchorPointX>0.5</sld:AnchorPointX>
<sld:AnchorPointY>0.5</sld:AnchorPointY>
</sld:AnchorPoint>
</sld:PointPlacement>
</sld:LabelPlacement>
<sld:Fill>
<sld:CssParameter name="fill">#000000</sld:CssParameter>
</sld:Fill>
<sld:Priority>50000</sld:Priority>
<sld:VendorOption name="autoWrap">100</sld:VendorOption>
<sld:VendorOption name="maxDisplacement">200</sld:VendorOption>
<sld:VendorOption name="goodnessOfFit">0.9</sld:VendorOption>
</sld:TextSymbolizer>
Support for pre-laid-out labels
FOSS4G 2017, Boston
August 14th-19th 2017
Raster styling
FOSS4G 2017, Boston
August 14th-19th 2017
A DEM and a color map
FOSS4G 2016, Bonn
24nd – 24th August 2016
 SRTM from USGS
 Standard color map
 No-data natively
transparent in 2.8.x
thanks to JAI-EXT
[@sd > 75000] {
raster-channels: auto;
raster-color-map:
color-map-entry(#00BFBF, -100.0, 0)
color-map-entry(#00FF00, 920.0, 0)
color-map-entry(#00FF00, 920.0, 1.0)
color-map-entry(#FFFF00, 1940.0, 1.0)
color-map-entry(#FFFF00, 1940.0, 1.0)
color-map-entry(#FF7F00, 2960.0, 1.0)
color-map-entry(#FF7F00, 2960.0, 1.0)
color-map-entry(#BF7F3F, 3980.0, 1.0)
color-map-entry(#BF7F3F, 3980.0, 1.0)
color-map-entry(#141514, 5000.0, 1.0);
}
Contrast enhancement
http://docs.geoserver.org/latest/en/user/styling/sld-
reference/rastersymbolizer.html#contrastenhancement
FOSS4G 2017, Boston
August 14th-19th 2017
<sld:RasterSymbolizer>
<sld:ContrastEnhancement>
<sld:Normalize>
<sld:VendorOption name="algorithm">
StretchToMinimumMaximum
</sld:VendorOption>
<sld:VendorOption name="minValue">50</sld:VendorOption>
<sld:VendorOption name="maxValue">800</sld:VendorOption>
</sld:Normalize>
</sld:ContrastEnhancement>
</sld:RasterSymbolizer>
GeoServer
vendor extension
Other assorted features
FOSS4G 2017, Boston
August 14th-19th 2017
Geometry transformations
FOSS4G 2017, Boston
August 14th-19th 2017
[@scale < 10000] {
fill-geometry: [offset(the_geom, 6, -6)];
fill: darkgray;
z-index: 0;
}
[@scale < 10000] {
fill: #b3b3b3;
z-index: 1;
}
Rendering transformations
FOSS4G 2017, Boston
August 14th-19th 2017
* {
transform: ras:Contour(levels:
1100 1200 1300 1400
1500 1600 1700 1800);
stroke: black;
label: [GRAY-INDEX];
font-fill: black;
font-family: Sans;
font-size: 12;
halo-radius: 2;
halo-color: white;
label-follow-line: true
}
Masking via alpha compositing
FOSS4G 2016, Bonn
24nd – 24th August 2016
destination-in
Color blendin
FOSS4G 2017, Boston
August 14th-19th 2017
http://docs.geoserver.org/stable/user/styling/sld-extensions/composite-blend/index.html
More info at:
Z ordering
http://docs.geoserver.org/latest/en/user/styling/sld-
extensions/z-order/example.html
FOSS4G 2017, Boston
August 14th-19th 2017
[class = 'motorways'] {
stroke: #990000;
stroke-width: 8;
z-index: 0;
}
[class = 'railways'] {
stroke: #333333;
stroke-width: 3;
z-index: 2;
}
[class = 'railways'] {
stroke: #ffffff;
stroke-width: 1.5;
stroke-dasharray: 5, 5;
z-index: 3;
}
[class = 'motorways'] {
stroke: #ff6666;
stroke-width: 6;
stroke-linecap: round;
z-index: 3;
}
* {
sort-by: "z_order";
sort-by-group: "roadsGroup";
}
New in 2.12
FOSS4G 2017, Boston
August 14th-19th 2017
Autocomplete for CSS editor
 Because there are too many properties to
remember!
FOSS4G 2017, Boston
August 14th-19th 2017
No more -gt- prefix in CSS
 Vendor options used to be prefixed with “-gt-”
 But CSS is its own language, no need to mark
something as “vendor” or refer to GeoTools
 Don’t worry, old syntax still supported
FOSS4G 2017, Boston
August 14th-19th 2017
* {
...
-gt-mark-label-obstacle: true;
-gt-label-priority: 200000;
-gt-label-auto-wrap: 100;
}
* {
...
mark-label-obstacle: true;
label-priority: 200000;
label-auto-wrap: 100;
}
GeoCSS env variable expansion
 Use @var or @var(defaultValue) in place of calling the
env function
 @var -> env(‘var’)
 @var(defaultValue)  env(‘var’, defaultValue)
 Exception for @sd
 @sd -> env(‘wms_scale_denominator’)
 to get a more fluent syntax for scale dependencies
 New in 2.12
FOSS4G 2017, Boston
August 14th-19th 2017
Underline and strikethrough
 New vendor options to control underline and
strikethrough
FOSS4G 2017, Boston
August 14th-19th 2017
<VendorOption name="underlineText">true</VendorOption>
<VendorOption name="strikethroughText">true</VendorOption>
Char and word spacing
 Control how much space there is between each
char
 And between words
FOSS4G 2017, Boston
August 14th-19th 2017
<VendorOption name="charSpacing">3</VendorOption>
<VendorOption name="wordSpacing">5</VendorOption>
charSpacing = 3 wordSpacing = 5
SVG marks
 Refer to a SVG file insinde
mark/WellKnownMark
 The outline of the SVG will be extracted
 Then filled and stroked as requested
 Suitable for simple shapes
FOSS4G 2017, Boston
August 14th-19th 2017
:mark {
fill: red;
stroke: yellow;
stroke-width: 3;
stroke-opacity: 50%;
}
More QGIS SLD export work
 In QGIS 3.0 support for label exports (thanks for
OpenGeoGroep sponsoring)
 Want to see more? Help us fund the effort 
FOSS4G 2017, Boston
August 14th-19th 2017
That’s all folks!
Questions?
info@geo-solutions.it
FOSS4G 2017, Boston
August 14th-19th 2017
1 of 51

Recommended

GeoServer, an introduction for beginners by
GeoServer, an introduction for beginnersGeoServer, an introduction for beginners
GeoServer, an introduction for beginnersGeoSolutions
8.5K views51 slides
Serving earth observation data with GeoServer: addressing real world requirem... by
Serving earth observation data with GeoServer: addressing real world requirem...Serving earth observation data with GeoServer: addressing real world requirem...
Serving earth observation data with GeoServer: addressing real world requirem...GeoSolutions
19.7K views61 slides
Crunching Data In GeoServer: Mastering Rendering Transformations, WPS Process... by
Crunching Data In GeoServer: Mastering Rendering Transformations, WPS Process...Crunching Data In GeoServer: Mastering Rendering Transformations, WPS Process...
Crunching Data In GeoServer: Mastering Rendering Transformations, WPS Process...GeoSolutions
19.6K views60 slides
GeoServer on Steroids by
GeoServer on Steroids GeoServer on Steroids
GeoServer on Steroids GeoSolutions
8.7K views45 slides
Mastering Security with GeoServer and GeoFence - FOSS4G EU 2017 by
Mastering Security with GeoServer and GeoFence - FOSS4G EU 2017Mastering Security with GeoServer and GeoFence - FOSS4G EU 2017
Mastering Security with GeoServer and GeoFence - FOSS4G EU 2017GeoSolutions
20.1K views39 slides
Enterprise class deployment for GeoServer and GeoWebcache Optimizing perform... by
Enterprise class deployment  for GeoServer and GeoWebcache Optimizing perform...Enterprise class deployment  for GeoServer and GeoWebcache Optimizing perform...
Enterprise class deployment for GeoServer and GeoWebcache Optimizing perform...GeoSolutions
3.6K views85 slides

More Related Content

What's hot

GeoServer in Production: we do it, here is how! by
GeoServer in Production: we do it, here is how!GeoServer in Production: we do it, here is how!
GeoServer in Production: we do it, here is how!GeoSolutions
30.6K views57 slides
Raster Data In GeoServer And GeoTools: Achievements, Issues And Future Develo... by
Raster Data In GeoServer And GeoTools: Achievements, Issues And Future Develo...Raster Data In GeoServer And GeoTools: Achievements, Issues And Future Develo...
Raster Data In GeoServer And GeoTools: Achievements, Issues And Future Develo...GeoSolutions
5.9K views52 slides
공간정보거점대학 1.geo server_고급과정 by
공간정보거점대학 1.geo server_고급과정공간정보거점대학 1.geo server_고급과정
공간정보거점대학 1.geo server_고급과정BJ Jang
19.5K views41 slides
Spatio-temporal Data Handling With GeoServer for MetOc And Remote Sensing by
Spatio-temporal Data Handling With GeoServer for MetOc And Remote SensingSpatio-temporal Data Handling With GeoServer for MetOc And Remote Sensing
Spatio-temporal Data Handling With GeoServer for MetOc And Remote SensingGeoSolutions
1.8K views66 slides
공간정보연구원 PostGIS 강의교재 by
공간정보연구원 PostGIS 강의교재공간정보연구원 PostGIS 강의교재
공간정보연구원 PostGIS 강의교재JungHwan Yun
6.6K views150 slides
GeoServer on Steroids by
GeoServer on SteroidsGeoServer on Steroids
GeoServer on SteroidsGeoSolutions
13.3K views77 slides

What's hot(20)

GeoServer in Production: we do it, here is how! by GeoSolutions
GeoServer in Production: we do it, here is how!GeoServer in Production: we do it, here is how!
GeoServer in Production: we do it, here is how!
GeoSolutions30.6K views
Raster Data In GeoServer And GeoTools: Achievements, Issues And Future Develo... by GeoSolutions
Raster Data In GeoServer And GeoTools: Achievements, Issues And Future Develo...Raster Data In GeoServer And GeoTools: Achievements, Issues And Future Develo...
Raster Data In GeoServer And GeoTools: Achievements, Issues And Future Develo...
GeoSolutions5.9K views
공간정보거점대학 1.geo server_고급과정 by BJ Jang
공간정보거점대학 1.geo server_고급과정공간정보거점대학 1.geo server_고급과정
공간정보거점대학 1.geo server_고급과정
BJ Jang19.5K views
Spatio-temporal Data Handling With GeoServer for MetOc And Remote Sensing by GeoSolutions
Spatio-temporal Data Handling With GeoServer for MetOc And Remote SensingSpatio-temporal Data Handling With GeoServer for MetOc And Remote Sensing
Spatio-temporal Data Handling With GeoServer for MetOc And Remote Sensing
GeoSolutions1.8K views
공간정보연구원 PostGIS 강의교재 by JungHwan Yun
공간정보연구원 PostGIS 강의교재공간정보연구원 PostGIS 강의교재
공간정보연구원 PostGIS 강의교재
JungHwan Yun6.6K views
GeoServer on Steroids by GeoSolutions
GeoServer on SteroidsGeoServer on Steroids
GeoServer on Steroids
GeoSolutions13.3K views
GeoTools와 GeoServer를 이용한 KOPSS Open API의 구현 by MinPa Lee
GeoTools와 GeoServer를 이용한 KOPSS Open API의 구현GeoTools와 GeoServer를 이용한 KOPSS Open API의 구현
GeoTools와 GeoServer를 이용한 KOPSS Open API의 구현
MinPa Lee5.5K views
Open Source GIS 기초교육 4일차 - GeoServer 기초 2014년 7월판 by BJ Jang
Open Source GIS 기초교육 4일차 - GeoServer 기초 2014년 7월판Open Source GIS 기초교육 4일차 - GeoServer 기초 2014년 7월판
Open Source GIS 기초교육 4일차 - GeoServer 기초 2014년 7월판
BJ Jang23.9K views
Introduction to Apache solr by Knoldus Inc.
Introduction to Apache solrIntroduction to Apache solr
Introduction to Apache solr
Knoldus Inc.1.7K views
오픈소스GIS 개론 과정 - OpenLayers 기초 by HaNJiN Lee
오픈소스GIS 개론 과정 - OpenLayers 기초오픈소스GIS 개론 과정 - OpenLayers 기초
오픈소스GIS 개론 과정 - OpenLayers 기초
HaNJiN Lee43.6K views
Advanced GeoServer Security with GeoFence by GeoSolutions
Advanced GeoServer Security with GeoFenceAdvanced GeoServer Security with GeoFence
Advanced GeoServer Security with GeoFence
GeoSolutions8.5K views
Using GeoServer for spatio-temporal data management with examples for MetOc a... by GeoSolutions
Using GeoServer for spatio-temporal data management with examples for MetOc a...Using GeoServer for spatio-temporal data management with examples for MetOc a...
Using GeoServer for spatio-temporal data management with examples for MetOc a...
GeoSolutions8.9K views
[FOSS4G Korea 2016] Workshop - Advanced GeoServer by MinPa Lee
[FOSS4G Korea 2016] Workshop - Advanced GeoServer[FOSS4G Korea 2016] Workshop - Advanced GeoServer
[FOSS4G Korea 2016] Workshop - Advanced GeoServer
MinPa Lee4.8K views
Advanced Security With GeoServer by GeoSolutions
Advanced Security With GeoServerAdvanced Security With GeoServer
Advanced Security With GeoServer
GeoSolutions7.7K views
공간정보 거점대학 - OpenLayers의 고급 기능 이해 및 실습 by HaNJiN Lee
 공간정보 거점대학 - OpenLayers의 고급 기능 이해 및 실습 공간정보 거점대학 - OpenLayers의 고급 기능 이해 및 실습
공간정보 거점대학 - OpenLayers의 고급 기능 이해 및 실습
HaNJiN Lee33.6K views
PostGIS - National Education Center for GIS: Open Source GIS by MinPa Lee
PostGIS - National Education Center for GIS: Open Source GIS PostGIS - National Education Center for GIS: Open Source GIS
PostGIS - National Education Center for GIS: Open Source GIS
MinPa Lee5.8K views
[Foss4 g2013 korea]postgis와 geoserver를 이용한 대용량 공간데이터 기반 일기도 서비스 구축 사례 by BJ Jang
[Foss4 g2013 korea]postgis와 geoserver를 이용한 대용량 공간데이터 기반 일기도 서비스 구축 사례[Foss4 g2013 korea]postgis와 geoserver를 이용한 대용량 공간데이터 기반 일기도 서비스 구축 사례
[Foss4 g2013 korea]postgis와 geoserver를 이용한 대용량 공간데이터 기반 일기도 서비스 구축 사례
BJ Jang3.7K views
Geonode introduction by Tek Kshetri
Geonode introductionGeonode introduction
Geonode introduction
Tek Kshetri369 views
오픈소스 GIS 교육 - PostGIS by JungHwan Yun
오픈소스 GIS 교육 - PostGIS오픈소스 GIS 교육 - PostGIS
오픈소스 GIS 교육 - PostGIS
JungHwan Yun18.1K views

Similar to Creating Stunning Maps in GeoServer: mastering SLD and CSS styles

Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007... by
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...Beat Signer
45.6K views61 slides
MongoDB at the Silicon Valley iPhone and iPad Developers' Meetup by
MongoDB at the Silicon Valley iPhone and iPad Developers' MeetupMongoDB at the Silicon Valley iPhone and iPad Developers' Meetup
MongoDB at the Silicon Valley iPhone and iPad Developers' MeetupMongoDB
8.4K views44 slides
Local Government Presentation by
Local Government PresentationLocal Government Presentation
Local Government Presentationguestd70a6d
951 views50 slides
MapServer Project Status 2013 by
MapServer Project Status 2013MapServer Project Status 2013
MapServer Project Status 2013Jeff McKenna
1.8K views34 slides
GeoServer intro for SDI Days 2013 by
GeoServer intro for SDI Days 2013GeoServer intro for SDI Days 2013
GeoServer intro for SDI Days 2013GeoSolutions
2.3K views55 slides
State of the Art Web Mapping with Open Source by
State of the Art Web Mapping with Open SourceState of the Art Web Mapping with Open Source
State of the Art Web Mapping with Open SourceOSCON Byrum
6K views95 slides

Similar to Creating Stunning Maps in GeoServer: mastering SLD and CSS styles(20)

Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007... by Beat Signer
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Beat Signer45.6K views
MongoDB at the Silicon Valley iPhone and iPad Developers' Meetup by MongoDB
MongoDB at the Silicon Valley iPhone and iPad Developers' MeetupMongoDB at the Silicon Valley iPhone and iPad Developers' Meetup
MongoDB at the Silicon Valley iPhone and iPad Developers' Meetup
MongoDB8.4K views
Local Government Presentation by guestd70a6d
Local Government PresentationLocal Government Presentation
Local Government Presentation
guestd70a6d951 views
MapServer Project Status 2013 by Jeff McKenna
MapServer Project Status 2013MapServer Project Status 2013
MapServer Project Status 2013
Jeff McKenna1.8K views
GeoServer intro for SDI Days 2013 by GeoSolutions
GeoServer intro for SDI Days 2013GeoServer intro for SDI Days 2013
GeoServer intro for SDI Days 2013
GeoSolutions2.3K views
State of the Art Web Mapping with Open Source by OSCON Byrum
State of the Art Web Mapping with Open SourceState of the Art Web Mapping with Open Source
State of the Art Web Mapping with Open Source
OSCON Byrum6K views
NAPSG 2010 Fire/EMS Conference - Data Sharing Basics by pdituri
NAPSG 2010 Fire/EMS Conference - Data Sharing BasicsNAPSG 2010 Fire/EMS Conference - Data Sharing Basics
NAPSG 2010 Fire/EMS Conference - Data Sharing Basics
pdituri363 views
Serving earth observation data with GeoServer: addressing real world requirem... by GeoSolutions
Serving earth observation data with GeoServer: addressing real world requirem...Serving earth observation data with GeoServer: addressing real world requirem...
Serving earth observation data with GeoServer: addressing real world requirem...
GeoSolutions2.1K views
Trivadis TechEvent 2016 Introduction to DataStax Enterprise (DSE) Graph by Gu... by Trivadis
Trivadis TechEvent 2016 Introduction to DataStax Enterprise (DSE) Graph by Gu...Trivadis TechEvent 2016 Introduction to DataStax Enterprise (DSE) Graph by Gu...
Trivadis TechEvent 2016 Introduction to DataStax Enterprise (DSE) Graph by Gu...
Trivadis644 views
Advanced Cartographic Map Rendering In GeoServer by GeoSolutions
Advanced Cartographic Map Rendering In GeoServerAdvanced Cartographic Map Rendering In GeoServer
Advanced Cartographic Map Rendering In GeoServer
GeoSolutions4.1K views
State of GeoServer 2.12 by GeoSolutions
State of GeoServer 2.12State of GeoServer 2.12
State of GeoServer 2.12
GeoSolutions6.1K views
IBM Insight 2015 - 1823 - Geospatial analytics with dashDB in the cloud by Torsten Steinbach
IBM Insight 2015 - 1823 - Geospatial analytics with dashDB in the cloudIBM Insight 2015 - 1823 - Geospatial analytics with dashDB in the cloud
IBM Insight 2015 - 1823 - Geospatial analytics with dashDB in the cloud
Torsten Steinbach196 views
CSS3: The Next Generation Of Style by jbellWCT
CSS3: The Next Generation Of StyleCSS3: The Next Generation Of Style
CSS3: The Next Generation Of Style
jbellWCT335 views
Extending 3D Model Visualization with FME 2017 by Safe Software
Extending 3D Model Visualization with FME 2017Extending 3D Model Visualization with FME 2017
Extending 3D Model Visualization with FME 2017
Safe Software1.2K views
SQL Server 2008 Overview by Eric Nelson
SQL Server 2008 OverviewSQL Server 2008 Overview
SQL Server 2008 Overview
Eric Nelson551 views

More from GeoSolutions

MapStore 2 - The Story by
MapStore 2 - The StoryMapStore 2 - The Story
MapStore 2 - The StoryGeoSolutions
2K views51 slides
One GeoNode, many GeoNodes by
One GeoNode, many GeoNodesOne GeoNode, many GeoNodes
One GeoNode, many GeoNodesGeoSolutions
1.9K views53 slides
Introduction to GeoNode by
Introduction to GeoNodeIntroduction to GeoNode
Introduction to GeoNodeGeoSolutions
7.6K views42 slides
GeoServer Feature FRENZY by
GeoServer Feature FRENZYGeoServer Feature FRENZY
GeoServer Feature FRENZYGeoSolutions
3.5K views108 slides
MapStore 2, modern mashups with OL3, Leaflet and React by
MapStore 2, modern mashups with OL3, Leaflet and ReactMapStore 2, modern mashups with OL3, Leaflet and React
MapStore 2, modern mashups with OL3, Leaflet and ReactGeoSolutions
15.9K views86 slides
State of GeoServer - FOSS4G 2016 by
State of GeoServer - FOSS4G 2016State of GeoServer - FOSS4G 2016
State of GeoServer - FOSS4G 2016GeoSolutions
20.5K views71 slides

More from GeoSolutions(18)

One GeoNode, many GeoNodes by GeoSolutions
One GeoNode, many GeoNodesOne GeoNode, many GeoNodes
One GeoNode, many GeoNodes
GeoSolutions1.9K views
Introduction to GeoNode by GeoSolutions
Introduction to GeoNodeIntroduction to GeoNode
Introduction to GeoNode
GeoSolutions7.6K views
GeoServer Feature FRENZY by GeoSolutions
GeoServer Feature FRENZYGeoServer Feature FRENZY
GeoServer Feature FRENZY
GeoSolutions3.5K views
MapStore 2, modern mashups with OL3, Leaflet and React by GeoSolutions
MapStore 2, modern mashups with OL3, Leaflet and ReactMapStore 2, modern mashups with OL3, Leaflet and React
MapStore 2, modern mashups with OL3, Leaflet and React
GeoSolutions15.9K views
State of GeoServer - FOSS4G 2016 by GeoSolutions
State of GeoServer - FOSS4G 2016State of GeoServer - FOSS4G 2016
State of GeoServer - FOSS4G 2016
GeoSolutions20.5K views
Advanced Security with GeoServer - FOSS4G 2015 by GeoSolutions
Advanced Security with GeoServer - FOSS4G 2015Advanced Security with GeoServer - FOSS4G 2015
Advanced Security with GeoServer - FOSS4G 2015
GeoSolutions2.4K views
Raster Data In GeoServer and GeoTools: Achievements, Issues And Future Develo... by GeoSolutions
Raster Data In GeoServer and GeoTools: Achievements, Issues And Future Develo...Raster Data In GeoServer and GeoTools: Achievements, Issues And Future Develo...
Raster Data In GeoServer and GeoTools: Achievements, Issues And Future Develo...
GeoSolutions2.1K views
Mapping the world beyond web mercator - FOSS4G 2015 by GeoSolutions
Mapping the world beyond web mercator - FOSS4G 2015Mapping the world beyond web mercator - FOSS4G 2015
Mapping the world beyond web mercator - FOSS4G 2015
GeoSolutions4.6K views
GeoServer for Spatio-temporal Data Handling With Examples For MetOc And Remot... by GeoSolutions
GeoServer for Spatio-temporal Data Handling With Examples For MetOc And Remot...GeoServer for Spatio-temporal Data Handling With Examples For MetOc And Remot...
GeoServer for Spatio-temporal Data Handling With Examples For MetOc And Remot...
GeoSolutions1.6K views
Advanced Cartographic Map Rendering in GeoServer by GeoSolutions
Advanced Cartographic Map Rendering in GeoServerAdvanced Cartographic Map Rendering in GeoServer
Advanced Cartographic Map Rendering in GeoServer
GeoSolutions2.6K views
GeoSolutions Keynote at WebMGS 2015 by GeoSolutions
GeoSolutions Keynote at WebMGS 2015GeoSolutions Keynote at WebMGS 2015
GeoSolutions Keynote at WebMGS 2015
GeoSolutions1.1K views
GeoServer beginners gwf_2015 by GeoSolutions
GeoServer beginners gwf_2015GeoServer beginners gwf_2015
GeoServer beginners gwf_2015
GeoSolutions4.7K views
Geosolutions gwf-2015-v01.04 by GeoSolutions
Geosolutions gwf-2015-v01.04Geosolutions gwf-2015-v01.04
Geosolutions gwf-2015-v01.04
GeoSolutions1.4K views
Geoserver introduction, GeoBusiness 2015 by GeoSolutions
Geoserver introduction, GeoBusiness 2015Geoserver introduction, GeoBusiness 2015
Geoserver introduction, GeoBusiness 2015
GeoSolutions1.7K views
Introduzione a GeoServer ed ai servizi OGC by GeoSolutions
Introduzione a GeoServer ed ai servizi OGCIntroduzione a GeoServer ed ai servizi OGC
Introduzione a GeoServer ed ai servizi OGC
GeoSolutions3.4K views
GeoServer on Steroids at FOSS4G Europe 2014 by GeoSolutions
GeoServer on Steroids at FOSS4G Europe 2014GeoServer on Steroids at FOSS4G Europe 2014
GeoServer on Steroids at FOSS4G Europe 2014
GeoSolutions5.4K views
GeoNetwork, The Open Source Solution for the interoperable management of ge... by GeoSolutions
GeoNetwork, The Open Source Solution  for the interoperable management  of ge...GeoNetwork, The Open Source Solution  for the interoperable management  of ge...
GeoNetwork, The Open Source Solution for the interoperable management of ge...
GeoSolutions6.6K views

Recently uploaded

Microsoft Power Platform.pptx by
Microsoft Power Platform.pptxMicrosoft Power Platform.pptx
Microsoft Power Platform.pptxUni Systems S.M.S.A.
53 views38 slides
Voice Logger - Telephony Integration Solution at Aegis by
Voice Logger - Telephony Integration Solution at AegisVoice Logger - Telephony Integration Solution at Aegis
Voice Logger - Telephony Integration Solution at AegisNirmal Sharma
39 views1 slide
virtual reality.pptx by
virtual reality.pptxvirtual reality.pptx
virtual reality.pptxG036GaikwadSnehal
11 views15 slides
STPI OctaNE CoE Brochure.pdf by
STPI OctaNE CoE Brochure.pdfSTPI OctaNE CoE Brochure.pdf
STPI OctaNE CoE Brochure.pdfmadhurjyapb
14 views1 slide
TouchLog: Finger Micro Gesture Recognition Using Photo-Reflective Sensors by
TouchLog: Finger Micro Gesture Recognition  Using Photo-Reflective SensorsTouchLog: Finger Micro Gesture Recognition  Using Photo-Reflective Sensors
TouchLog: Finger Micro Gesture Recognition Using Photo-Reflective Sensorssugiuralab
19 views15 slides

Recently uploaded(20)

Voice Logger - Telephony Integration Solution at Aegis by Nirmal Sharma
Voice Logger - Telephony Integration Solution at AegisVoice Logger - Telephony Integration Solution at Aegis
Voice Logger - Telephony Integration Solution at Aegis
Nirmal Sharma39 views
STPI OctaNE CoE Brochure.pdf by madhurjyapb
STPI OctaNE CoE Brochure.pdfSTPI OctaNE CoE Brochure.pdf
STPI OctaNE CoE Brochure.pdf
madhurjyapb14 views
TouchLog: Finger Micro Gesture Recognition Using Photo-Reflective Sensors by sugiuralab
TouchLog: Finger Micro Gesture Recognition  Using Photo-Reflective SensorsTouchLog: Finger Micro Gesture Recognition  Using Photo-Reflective Sensors
TouchLog: Finger Micro Gesture Recognition Using Photo-Reflective Sensors
sugiuralab19 views
Empathic Computing: Delivering the Potential of the Metaverse by Mark Billinghurst
Empathic Computing: Delivering  the Potential of the MetaverseEmpathic Computing: Delivering  the Potential of the Metaverse
Empathic Computing: Delivering the Potential of the Metaverse
Mark Billinghurst478 views
Serverless computing with Google Cloud (2023-24) by wesley chun
Serverless computing with Google Cloud (2023-24)Serverless computing with Google Cloud (2023-24)
Serverless computing with Google Cloud (2023-24)
wesley chun11 views
HTTP headers that make your website go faster - devs.gent November 2023 by Thijs Feryn
HTTP headers that make your website go faster - devs.gent November 2023HTTP headers that make your website go faster - devs.gent November 2023
HTTP headers that make your website go faster - devs.gent November 2023
Thijs Feryn22 views
Piloting & Scaling Successfully With Microsoft Viva by Richard Harbridge
Piloting & Scaling Successfully With Microsoft VivaPiloting & Scaling Successfully With Microsoft Viva
Piloting & Scaling Successfully With Microsoft Viva
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive by Network Automation Forum
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveAutomating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas... by Bernd Ruecker
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
Bernd Ruecker37 views
handbook for web 3 adoption.pdf by Liveplex
handbook for web 3 adoption.pdfhandbook for web 3 adoption.pdf
handbook for web 3 adoption.pdf
Liveplex22 views

Creating Stunning Maps in GeoServer: mastering SLD and CSS styles

  • 1. Creating stunning maps with GeoServer Mastering SLD and CSS Ing. Andrea Aime GeoSolutions
  • 2. GeoSolutions  Founded in Italy in late 2006  Expertise • Image Processing, GeoSpatial Data Fusion • Java, Java Enterprise, C++, Python • JPEG2000, JPIP, Advanced 2D visualization  Supporting/Developing FOSS4G projects  GeoServer, MapStore  GeoNetwork, GeoNode, Ckan  Clients  Public Agencies  Private Companies  http://www.geo-solutions.it FOSS4G 2017, Boston August 14th-19th 2017
  • 3. SLD vs CSS  Styled Layer Descriptor  OGC standard  XML based, verbose, hard to hand edit  Only showing relevant bits of the SLD  GeoCSS  CSS with extensions for map rendering  Simple, Compact, designed for human beings  Not a standard (several incompatible variants for mapping, GeoServer one has nothing to do with CartoDB/MapBox one) FOSS4G 2017, Boston August 14th-19th 2017
  • 4. CSS features  Familiar for web developers  Compact syntax  Symbolization triggered by “key” properties (stroke, fill, mark, label, channel-selection)  CQL based filtering  Cascading keeps complex styling compact (you just express the overrides to the base)  Interactive editor for productive style development FOSS4G 2017, Boston August 14th-19th 2017
  • 5. GeoCSS in a nutshell • Filter by attribute/env variable in CQL • Filter by scale • Set properties to control symbolization • Key properties activate certain symbolization: – mark/fill/stroke/label/raster-channels FOSS4G 2017, Boston August 14th-19th 2017 [admin_level < 2][@sd < 1M][@sd > 100k] { label: name; font-family: ‘Noto Sans’; … /* this is nested rule */ [special = true][@sd < 500k] { font-weight: bold; … } }
  • 6. SLD equivalents FOSS4G 2017, Boston August 14th-19th 2017 <sld:Rule> <ogc:Filter> <ogc:PropertyIsEqualTo> <ogc:PropertyName>admin_level</ogc:PropertyName> <ogc:Literal>2</ogc:Literal> </ogc:PropertyIsEqualTo> </ogc:Filter> <sld:MinScaleDenominator>100000</sld:MinScaleDenominator> <sld:MaxScaleDenominator>1000000</sld:MaxScaleDenominator> <sld:TextSymbolizer> <sld:Label> <ogc:PropertyName>name</ogc:PropertyName> </sld:Label> <sld:Font> <sld:CssParameter name="font-family"> Noto Sans </sld:CssParameter> <sld:CssParameter name="font-size">10 ... </sld:TextSymbolizer> <!–- Override would require a separate rule specifying everything again --> </sld:Rule> Filter Scale dependency Symbolizers and their properties
  • 7. Scale dependencies FOSS4G 2017, Boston August 14th-19th 2017
  • 8. Types of Scale dependency  Decide whether to symbolize based on the scale or not  E.g., at lower scales/lower zoom levels do not show buildings  Symbolize in a different way depending on the scale  E.g., different thickness based on the current zoom FOSS4G 2017, Boston August 14th-19th 2017
  • 9. Expressing scale dependency filters  SLD:  <MinScaleDenominator>  <MaxScaleDenominator>  CSS  Legacy: [@scale > 10000000]  GeoServer 2.12+: [@sd > 1M]  More compact variable, more correct (it’s a scale denominator, not a scale!)  Compact expression of large numbers makes them readable at a glance, e.g., 100k, 1M FOSS4G 2017, Boston August 14th-19th 2017
  • 10. Unit of Measure FOSS4G 2017, Boston August 14th-19th 2017  Useful if you have real world measures of line thicknesses and the like <LineSymbolizer uom="http://www.opengeospatial.org/se/units/metre"> <Stroke> <CssParameter name="stroke">#0000FF</CssParameter> <CssParameter name="stroke-width">5</CssParameter> </Stroke> </LineSymbolizer> * { stroke: blue; stroke-width: 5m; }
  • 11. Transformation functions FOSS4G 2017, Boston August 14th-19th 2017  OSM like, setting a different value depending on the current scale/zoom level  Not a linear scale mind [class = 'highway’ and type in ('motorway’, 'motorway_link’)] [@sd < 25M] { stroke: #e66e89; stroke-width: categorize(@sd, 2, 400k, 1.9, 800k, 1.4, 1.5M, 1, 3M, 0.8, 6M, 0.5); …  Less than 400k  2px  [400k, 800k]  1.9px  [800k, 1.5M]  1.4px  [1.5M, 3M]  1  [3M, 6M]  0.8  Above 6M -> 0.5
  • 12. Transformation functions in SLD FOSS4G 2017, Boston August 14th-19th 2017 <sld:LineSymbolizer> <sld:Stroke> <sld:CssParameter name="stroke">#e66e89</sld:CssParameter> <sld:CssParameter name="stroke-width"> <ogc:Function name="Categorize"> <ogc:Function name="env"> <ogc:Literal>wms_scale_denominator</ogc:Literal> </ogc:Function> <ogc:Literal>2</ogc:Literal> <ogc:Literal>400000</ogc:Literal> <ogc:Literal>1.9</ogc:Literal> <ogc:Literal>800000</ogc:Literal> <ogc:Literal>1.4</ogc:Literal> <ogc:Literal>1500000</ogc:Literal> <ogc:Literal>1</ogc:Literal> <ogc:Literal>3000000</ogc:Literal> <ogc:Literal>0.8</ogc:Literal> <ogc:Literal>6000000</ogc:Literal> <ogc:Literal>0.5</ogc:Literal> </ogc:Function> </sld:CssParameter> </sld:Stroke> </sld:LineSymbolizer>
  • 13. Point styling FOSS4G 2017, Boston August 14th-19th 2017
  • 14. Simple symbol FOSS4G 2017, Boston August 14th-19th 2017 [type = 'alpine_hut'][@sd < 100k] { mark: url('symbols/alpinehut.p.16.png'); } <sld:Rule> <ogc:Filter> <ogc:PropertyIsEqualTo> <ogc:PropertyName>type</ogc:PropertyName> <ogc:Literal>alpine_hut</ogc:Literal> </ogc:PropertyIsEqualTo> </ogc:Filter> <sld:MaxScaleDenominator>100000.0</sld:MaxScaleDenominator> <sld:PointSymbolizer> <sld:Graphic> <sld:ExternalGraphic> <sld:OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="symbols/alpinehut.p.16.png"/> <sld:Format>image/png</sld:Format> </sld:ExternalGraphic> </sld:Graphic> </sld:PointSymbolizer> </sld:Rule>
  • 15. Marks (SVG in this case) FOSS4G 2017, Boston August 14th-19th 2017 [type = 'bank'][@sd < 6k] { mark: symbol('file://symbols/bank.svg'); :mark { fill: #734a08 }; mark-size: 14; } <sld:Rule> <ogc:Filter> <ogc:PropertyIsEqualTo> <ogc:PropertyName>type</ogc:PropertyName> <ogc:Literal>bank</ogc:Literal> </ogc:PropertyIsEqualTo> </ogc:Filter> <sld:MaxScaleDenominator>6000.0</sld:MaxScaleDenominator> <sld:PointSymbolizer> <sld:Graphic> <sld:Mark> <sld:WellKnownName>file://symbols/bank.svg</sld:WellKnownName> <sld:Fill> <sld:CssParameter name="fill">#734a08</sld:CssParameter> </sld:Fill> </sld:Mark> <sld:Size>14</sld:Size> </sld:Graphic> </sld:PointSymbolizer> </sld:Rule> New in GeoServer 2.12!
  • 16. Marks composition and override FOSS4G 2017, Boston August 14th-19th 2017 [type = 'fountain'][@sd < 6k] { mark: symbol(circle), symbol(circle); :nth-mark(1) { fill: #b5d0d0 }; :nth-mark(2) { fill: #576ddf }; mark-size: 10, 3; [@sd < 3k] { mark: symbol('file://symbols/fountain.svg'); :mark { fill: #576ddf; }; } }
  • 17.  Many other options!  Built-in symbol names (well known marks): circle, square, triangle, …  From TTF fonts using the name ttf://<fontname>#charcode  Windbarbs, e.g.: windbarbs://default(15)[kts]  WKT specification, e.g. wkt://MULTILINESTRING((-0.25 -0.25, -0.125 -0.25), (0.125 - 0.25, 0.25 -0.25), (-0.25 0.25, -0.125 0.25), (0.125 0.25, 0.25 0.25))  See more here: http://docs.geoserver.org/latest/en/user/styling/sld/exte nsions/pointsymbols.html Other mark options FOSS4G 2017, Boston August 14th-19th 2017
  • 18. Filling polygons FOSS4G 2017, Boston August 14th-19th 2017
  • 19. Solid filling FOSS4G 2017, Boston August 14th-19th 2017 * { fill: lightgrey; stroke: black; stroke-width: 0.5; } <sld:PolygonSymbolizer> <sld:Fill> <sld:CssParameter name="fill">#d3d3d3</sld:CssParameter> </sld:Fill> <sld:Stroke> <sld:CssParameter name="stroke-width">0.5</sld:CssParameter> </sld:Stroke> </sld:PolygonSymbolizer>
  • 20. Filling with repeating images fill FOSS4G 2017, Boston August 14th-19th 2017 [@sd < 800k][type in ('cemetery', 'grave_yard')] { fill: #aacbaf; [@sd < 50k] { [religion = 'jewish'] { fill: #aacbaf, url('symbols/grave_yard_jewish.png'); }; [religion = 'christian'] { fill: #aacbaf, url('symbols/grave_yard_christian.png'); }; [religion = 'INT-generic'] { fill: #aacbaf, url('symbols/grave_yard_generic.png'); }; }; }
  • 21. Filling with repeating images (SLD) FOSS4G 2017, Boston August 14th-19th 2017 <sld:Rule> <ogc:Filter> <ogc:And> <ogc:Or> <ogc:PropertyIsEqualTo> <ogc:PropertyName>type</ogc:PropertyName> <ogc:Literal>cemetery</ogc:Literal> </ogc:PropertyIsEqualTo> <ogc:PropertyIsEqualTo> <ogc:PropertyName>type</ogc:PropertyName> <ogc:Literal>grave_yard</ogc:Literal> </ogc:PropertyIsEqualTo> </ogc:Or> <ogc:PropertyIsEqualTo> <ogc:PropertyName>religion</ogc:PropertyName> <ogc:Literal>jewish</ogc:Literal> </ogc:PropertyIsEqualTo> </ogc:And> </ogc:Filter> <sld:MaxScaleDenominator>50000.0</sld:MaxScaleDenominator> One sample rule (the Jewish religion one). Three more needed to get the same display as with CSS
  • 22. Filling with repeating images (SLD) FOSS4G 2017, Boston August 14th-19th 2017 <sld:PolygonSymbolizer> <sld:Fill> <sld:CssParameter name="fill">#aacbaf</sld:CssParameter> </sld:Fill> </sld:PolygonSymbolizer> <sld:PolygonSymbolizer> <sld:Fill> <sld:GraphicFill> <sld:Graphic> <sld:ExternalGraphic> <sld:OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="symbols/grave_yard_jewish.png" /> <sld:Format>image/png</sld:Format> </sld:ExternalGraphic> </sld:Graphic> </sld:GraphicFill> </sld:Fill> </sld:PolygonSymbolizer> </sld:Rule>
  • 23. Filling with marks FOSS4G 2017, Boston August 14th-19th 2017 <sld:PolygonSymbolizer> <sld:Fill> <sld:GraphicFill> <sld:Graphic> <sld:Mark> <sld:WellKnownName>shape://times</sld:WellKnownName> <sld:Stroke> <sld:CssParameter name="stroke">#ADD8E6</sld:CssParameter> </sld:Stroke> </sld:Mark> <sld:Size>8</sld:Size> </sld:Graphic> </sld:GraphicFill> </sld:Fill> </sld:PolygonSymbolizer> </sld:Rule> [@scale < 10000] { fill: symbol('shape://times'); fill-size: 8; :fill { stroke: #ADD8E6; } }
  • 24. Painting lines FOSS4G 2017, Boston August 14th-19th 2017
  • 25. Solid lines (OSM admin borders) FOSS4G 2017, Boston August 14th-19th 2017 [type = 'administrative'] { [admin_level <= 4], [admin_level = 5 or admin_level = 6][@sd <= 400k], [admin_level = 7 or admin_level = 8][@sd <= 200k], [admin_level = 9 or admin_level = 10][@sd <= 100k] { stroke: #ac46ac; stroke-opacity: 0.4; } } <!-- 5 different rules with different filters followed by this --> <sld:LineSymbolizer> <sld:Stroke> <sld:CssParameter name="stroke">#ac46ac</sld:CssParameter> <sld:CssParameter name="stroke-opacity">0.4</sld:CssParameter> </sld:Stroke> </sld:LineSymbolizer>
  • 26. Dashes FOSS4G 2017, Boston August 14th-19th 2017 … <sld:LineSymbolizer> <sld:Stroke> <sld:CssParameter name="stroke">#6B4900</sld:CssParameter> <sld:CssParameter name="stroke-width">0.1</sld:CssParameter> <sld:CssParameter name="stroke-dasharray">2 2</sld:CssParameter> </sld:Stroke> </sld:LineSymbolizer> [@sd < 75k] { stroke: #6B4900; stroke-width: 0.1; stroke-dasharray: 2; }
  • 27. Alternating dashes with marks FOSS4G 2017, Boston August 14th-19th 2017 * { stroke: darkRed, symbol('circle'); stroke-dasharray: 10 14, 6 18; stroke-dashoffset: 14, 0; :stroke { fill: darkRed; size: 6; } }  Two coordinated dashed lines  One made with lines  One made with circles  The offset shifts them to have one appear in the empty spaces of the other
  • 29. Vendor options FOSS4G 2017, Boston August 14th-19th 2017
  • 30. Point labels and obstacles FOSS4G 2017, Boston August 14th-19th 2017 [@sd < 200k] { label: [FULLNAME]; label-anchor: 0.5 1.0; label-offset: 0.0 -14.0; font-fill: #000033; font-family: Arial; font-size: 12; halo-color: white; halo-radius: 1.5; label-priority: 200000; label-auto-wrap: 100; mark: url('./img/landmarks/${IMAGE}’); mark-label-obstacle: true; } «FULLNAME» attribute Auto wrapping label with halo. Data driven symbol URLLabels won’t overlap the symbol
  • 31. Line labels FOSS4G 2017, Boston August 14th-19th 2017 [@sd < 200k] { label: [LABEL_NAME]; font-fill: #000000; font-family: Arial; font-size: 13; font-style: normal; font-weight: bold; halo-color: #FFFFFF; halo-radius: 1; label-follow-line: true; label-repeat: 400; label-group: true; label-max-displacement: 200; } Draw «LABEL_NAME», black, with white halo Draw them along lines, fuse segments with same label, repeat
  • 32. Polygon labels FOSS4G 2017, Boston August 14th-19th 2017 <sld:TextSymbolizer> <sld:Label> <ogc:PropertyName>FULLNAME</ogc:PropertyName> </sld:Label> <sld:Font> <sld:CssParameter name="font-family">Arial</sld:CssParameter> <sld:CssParameter name="font-size">14.0</sld:CssParameter> <sld:CssParameter name="font-weight">bold</sld:CssParameter> </sld:Font> <sld:LabelPlacement> <sld:PointPlacement> <sld:AnchorPoint> <sld:AnchorPointX>0.5</sld:AnchorPointX> <sld:AnchorPointY>0.5</sld:AnchorPointY> </sld:AnchorPoint> </sld:PointPlacement> </sld:LabelPlacement> <sld:Fill> <sld:CssParameter name="fill">#000000</sld:CssParameter> </sld:Fill> <sld:Priority>50000</sld:Priority> <sld:VendorOption name="autoWrap">100</sld:VendorOption> <sld:VendorOption name="maxDisplacement">200</sld:VendorOption> <sld:VendorOption name="goodnessOfFit">0.9</sld:VendorOption> </sld:TextSymbolizer>
  • 33. Support for pre-laid-out labels FOSS4G 2017, Boston August 14th-19th 2017
  • 34. Raster styling FOSS4G 2017, Boston August 14th-19th 2017
  • 35. A DEM and a color map FOSS4G 2016, Bonn 24nd – 24th August 2016  SRTM from USGS  Standard color map  No-data natively transparent in 2.8.x thanks to JAI-EXT [@sd > 75000] { raster-channels: auto; raster-color-map: color-map-entry(#00BFBF, -100.0, 0) color-map-entry(#00FF00, 920.0, 0) color-map-entry(#00FF00, 920.0, 1.0) color-map-entry(#FFFF00, 1940.0, 1.0) color-map-entry(#FFFF00, 1940.0, 1.0) color-map-entry(#FF7F00, 2960.0, 1.0) color-map-entry(#FF7F00, 2960.0, 1.0) color-map-entry(#BF7F3F, 3980.0, 1.0) color-map-entry(#BF7F3F, 3980.0, 1.0) color-map-entry(#141514, 5000.0, 1.0); }
  • 36. Contrast enhancement http://docs.geoserver.org/latest/en/user/styling/sld- reference/rastersymbolizer.html#contrastenhancement FOSS4G 2017, Boston August 14th-19th 2017 <sld:RasterSymbolizer> <sld:ContrastEnhancement> <sld:Normalize> <sld:VendorOption name="algorithm"> StretchToMinimumMaximum </sld:VendorOption> <sld:VendorOption name="minValue">50</sld:VendorOption> <sld:VendorOption name="maxValue">800</sld:VendorOption> </sld:Normalize> </sld:ContrastEnhancement> </sld:RasterSymbolizer> GeoServer vendor extension
  • 37. Other assorted features FOSS4G 2017, Boston August 14th-19th 2017
  • 38. Geometry transformations FOSS4G 2017, Boston August 14th-19th 2017 [@scale < 10000] { fill-geometry: [offset(the_geom, 6, -6)]; fill: darkgray; z-index: 0; } [@scale < 10000] { fill: #b3b3b3; z-index: 1; }
  • 39. Rendering transformations FOSS4G 2017, Boston August 14th-19th 2017 * { transform: ras:Contour(levels: 1100 1200 1300 1400 1500 1600 1700 1800); stroke: black; label: [GRAY-INDEX]; font-fill: black; font-family: Sans; font-size: 12; halo-radius: 2; halo-color: white; label-follow-line: true }
  • 40. Masking via alpha compositing FOSS4G 2016, Bonn 24nd – 24th August 2016 destination-in
  • 41. Color blendin FOSS4G 2017, Boston August 14th-19th 2017 http://docs.geoserver.org/stable/user/styling/sld-extensions/composite-blend/index.html More info at:
  • 42. Z ordering http://docs.geoserver.org/latest/en/user/styling/sld- extensions/z-order/example.html FOSS4G 2017, Boston August 14th-19th 2017 [class = 'motorways'] { stroke: #990000; stroke-width: 8; z-index: 0; } [class = 'railways'] { stroke: #333333; stroke-width: 3; z-index: 2; } [class = 'railways'] { stroke: #ffffff; stroke-width: 1.5; stroke-dasharray: 5, 5; z-index: 3; } [class = 'motorways'] { stroke: #ff6666; stroke-width: 6; stroke-linecap: round; z-index: 3; } * { sort-by: "z_order"; sort-by-group: "roadsGroup"; }
  • 43. New in 2.12 FOSS4G 2017, Boston August 14th-19th 2017
  • 44. Autocomplete for CSS editor  Because there are too many properties to remember! FOSS4G 2017, Boston August 14th-19th 2017
  • 45. No more -gt- prefix in CSS  Vendor options used to be prefixed with “-gt-”  But CSS is its own language, no need to mark something as “vendor” or refer to GeoTools  Don’t worry, old syntax still supported FOSS4G 2017, Boston August 14th-19th 2017 * { ... -gt-mark-label-obstacle: true; -gt-label-priority: 200000; -gt-label-auto-wrap: 100; } * { ... mark-label-obstacle: true; label-priority: 200000; label-auto-wrap: 100; }
  • 46. GeoCSS env variable expansion  Use @var or @var(defaultValue) in place of calling the env function  @var -> env(‘var’)  @var(defaultValue)  env(‘var’, defaultValue)  Exception for @sd  @sd -> env(‘wms_scale_denominator’)  to get a more fluent syntax for scale dependencies  New in 2.12 FOSS4G 2017, Boston August 14th-19th 2017
  • 47. Underline and strikethrough  New vendor options to control underline and strikethrough FOSS4G 2017, Boston August 14th-19th 2017 <VendorOption name="underlineText">true</VendorOption> <VendorOption name="strikethroughText">true</VendorOption>
  • 48. Char and word spacing  Control how much space there is between each char  And between words FOSS4G 2017, Boston August 14th-19th 2017 <VendorOption name="charSpacing">3</VendorOption> <VendorOption name="wordSpacing">5</VendorOption> charSpacing = 3 wordSpacing = 5
  • 49. SVG marks  Refer to a SVG file insinde mark/WellKnownMark  The outline of the SVG will be extracted  Then filled and stroked as requested  Suitable for simple shapes FOSS4G 2017, Boston August 14th-19th 2017 :mark { fill: red; stroke: yellow; stroke-width: 3; stroke-opacity: 50%; }
  • 50. More QGIS SLD export work  In QGIS 3.0 support for label exports (thanks for OpenGeoGroep sponsoring)  Want to see more? Help us fund the effort  FOSS4G 2017, Boston August 14th-19th 2017