In this example, we'll use the country data again and draw each polygon with two styles to create a shadow effect around the continents.
You can start from any of the examples in this chapter. We've started from the first example and removed the time zones for clarity. First, modify the
countryStyle
to provide a somewhat darker stroke:var countryStyle = new ol.style.Style({ fill: new ol.style.Fill({ color: [203, 194, 185, 1] }), stroke: new ol.style.Stroke({ color: [101, 95, 90, 1], width: 1 }), zIndex: 2 });
Next, we'll add our second style for the shadow effect:
var shadowStyle = new ol.style.Style({ stroke: new ol.style.Stroke({ color: [0, 0, 127, 0.15], width: 8 }), zIndex: 1 });
Finally, use both styles for the countries layer:
var countries = new ol.layer.Vector({ source: new ol.source.GeoJSON({ projection: 'EPSG:3857', url: '../assets/data/countries.geojson' }), style: [shadowStyle, countryStyle]...