Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
61 lines (55 sloc) 1.18 KB
<!doctype html>
<html lang="en">
<head>
<link rel="stylesheet" href="css/ol.css" type="text/css"/>
<link rel="stylesheet" href="css/sample.css" type="text/css"/>
<style>
body {
padding : 0;
margin : 0;
}
</style>
<title>OpenLayers 3 example 14 Vector Style 2</title>
</head>
<body>
<div id="map" class="map"></div>
<script src="js/jquery-2.1.4.min.js"></script>
<script src="js/ol-debug.js"></script>
<script type="text/javascript">
var vectorSource = new ol.source.Vector({
format: new ol.format.GeoJSON(),
url: 'js/countries.geojson'
});
var countryStyle = new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'rgba(0, 128, 0, 1.0)',
width: 2
}),
fill : new ol.style.Fill({
color: 'rgba(194, 255, 194, 1)'
}),
zIndex: 2
});
var shadowStyle = new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'rgba(0, 64, 0, 0.2)',
width: 8
}),
fill : null,
zIndex: 1
});
var vectorLayer = new ol.layer.Vector({
source: vectorSource,
style: [countryStyle, shadowStyle]
});
var map = new ol.Map({
target: 'map',
layers: [vectorLayer],
view: new ol.View({
center: ol.proj.transform([135, 35], 'EPSG:4326', 'EPSG:3857'),
zoom: 3
})
});
</script>
</body>
</html>
You can’t perform that action at this time.