ol.layer.Vector
by ahocevar
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/ol3/3.19.1/ol.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ol3/3.19.1/ol.css">
<div id="map"></div>
CSS
#map {
width: 512px;
height: 256px;
}
JavaScript
var map = new ol.Map({
target: 'map',
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
}),
new ol.layer.Vector({
title: 'Earthquakes',
source: new ol.source.Vector({
format: new ol.format.GeoJSON(),
url: 'https://rawgit.com/openlayers/workshop/v3.16.0/src/en/data/layers/7day-M2.5.json'
}),
style: new ol.style.Style({
image: new ol.style.Icon({
src: 'https://rawgit.com/mapbox/maki/master/icons/triangle-15.svg'
})
})
})
],
view: new ol.View({
center: [0, 0],
zoom: 1
})
});