libgd-gis uses YAML-based style definitions to control how maps and layers are rendered.
map.style = GD::GIS::Style.load("solarized")
This loads a style definition from a YAML file and applies it globally to the map.
Styles are defined using YAML files, usually located in:
examples/styles/
A style file describes how each layer should be drawn.
roads:
motorway:
stroke: [88, 110, 117]
stroke_width: 10
primary:
stroke: [147, 161, 161]
stroke_width: 6
minor:
stroke: [203, 75, 22]
stroke_width: 1
water:
stroke: [38, 139, 210]
fill: [7, 54, 66]
parks:
fill: [42, 161, 152]
GEOJSON = "data/home_store.geojson"
map.add_geojson(GEOJSON)
This parses the GeoJSON file, classifies its features, and renders them using the active style.
The same GeoJSON can be rendered with different styles without changing the data.