Presentation is loading. Please wait.

Presentation is loading. Please wait.

GeoServer CSS: Mapping in Style FOSS4G 2010 Barcelona, Spain.

Similar presentations


Presentation on theme: "GeoServer CSS: Mapping in Style FOSS4G 2010 Barcelona, Spain."— Presentation transcript:

1 GeoServer CSS: Mapping in Style FOSS4G 2010 Barcelona, Spain

2 David Winslow Developer, OpenGeo Technical Lead, GeoNode Contributor to GeoServer User of GeoExt, OpenLayers, GeoNetwork, PostGIS,... dwins on github, freenode, etc. Hi Everybody!

3 Overview SLD is for robots CSS is for people Use CSS!

4 Styling Basics What? How?

5 Styled Layer Descriptors: XML – General Purpose

6 Styled Layer Descriptors: XML - Validating

7 Styled Layer Descriptors: XML – Hierarchies

8 Styled Layer Descriptor: Feature Set Styling attributes Type constraints Layer ordering Inlined data?

9 Styled Layer Descriptor: Painter's Model Render each rule entirely Last rule wins

10 Road with Outline Rule: features like X LineSymbolizer Stroke – red, thick LineSymbolizer Stroke – yellow, thin

11 Styled Layer Descriptor – Painter's Model

12 FeatureTypeStyle Rule: features like X LineSymbolizer Stroke – red, thick FeatureTypeStyle Rule: features like X LineSymbolizer Stroke – yellow, thin

13 Styled Layer Descriptor – Painter's Model

14 Cascading Style Sheets: Specialized syntax Filter/Property pairs No boilerplate * { stroke: black; }

15 Cascading Style Sheets: Feature Set

16 Cascading Style Sheets: Cascading Model Combine properties Most specific rule wins

17 Cascading Style Sheets: Existing user base Every web developer Cascadenik, Cartagen, Halcyon...

18 Recap SLD XML Part of WMS Painter's Model Resolves Rules OGC Services CSS Custom-tailored Styling only Cascading inheritance Resolves properties In wide, general use

19

20

21 How do you use it? Translator reuse existing infrastructure avoid deploying experimental software in production easier comparison of functionality

22

23 Documentation

24 Example: Styling Roads

25

26

27 Vary color with type Vary stroke-width with scale

28 SLD

29

30

31

32

33

34

35

36 CSS

37

38

39

40

41

42

43

44

45

46

47 CSS <> SLD: Filters [att='value'] featuretype #id [@scale] Unified all constraints

48 CSS <> SLD: Repeated rendering * { stroke: red, yellow; stroke-width: 20px, 8px; z-index: 0, 10; }

49 CSS <> SLD: Repeated rendering * { stroke: red, yellow; stroke-width: 20px, 8px; z-index: 0, 10; }

50 CSS <> SLD: Styled marks

51 [type='hospital'] { mark: symbol(circle), symbol(cross); }

52 CSS <> SLD: Styled marks [type='hospital'] {... } [type='hospital'] :mark { fill: white; stroke: red; }

53 CSS <> SLD: Styled marks [type='hospital'] {... } [type='hospital'] :mark {... } [type='hospital'] :nth-mark(2) { fill: red; }

54 CSS <> SLD: Styled marks [type='hospital'] { mark: symbol(circle), symbol(cross); mark-size: 16px, 10px; } [type='hospital'] :mark {... } [type='hospital'] :nth-mark(2){... }

55 Potential Directions SLD ➙ CSS translator @import CSS + WMS CSS-aware editor Standardized Map CSS Raster styling

56 SLD ➙ CSS Translator Naive (wrong) version would be easy Important details – Combine rules from stacked FeatureTypeStyles – “factor out” commonalities – Title/Abstract metadata

57 @import(base.css) Share common definitions between multiple styles Not possible in SLD; relies on per- property rule combination to be useful

58 CSS + WMS Integrate CSS into WMS the way SLD is now in SLD? GetMap&css_body=... “refine” named styles from server

59 CSS-aware editor Syntax highlighting “palettes” – Fonts – Colors – Marks – Properties

60 Standardized Map CSS Existing tools – Mapnik – Cartagen – OSM (Halcyon) Each has different dialect with different model Sharing would be cool

61 Raster Styling Only “gap” left Not sure what it will look like yet

62 The Backend First “serious” project in Scala Zero “adapter” code Functional features – data transforms Parsing library

63 Scala Scala is to Java as CSS is to SLD “Just another library” at runtime Highly reduced boilerplate during development

64 Scala in GeoServer Just add water scala-library.jar Loaded like any other extension

65 Scala Collections val nums = List.make(1, 10) val (odds, evens) = nums.partition(_ % 2 != 0) val pairs = for (i <- nums; j <- nums) yield (i, j)

66 Parsing in Scala private val literal = percentage | measure | number | string | color

67 CSS <> SLD: Painter's Model to Cascading Exhaustive search Filter analysis (for speed)

68 Questions?


Download ppt "GeoServer CSS: Mapping in Style FOSS4G 2010 Barcelona, Spain."

Similar presentations


Ads by Google