We'll accomplish this in two steps. First, we'll replace the default style with a simple one, and then, we'll develop a new style to display smaller thumbnails:
extractStyles: false to its options:var flickrSource = new ol.source.KML({
url: '../assets/data/flickr_data.kml',
projection: 'EPSG:3857',
extractStyles: false
});function flickrStyle(feature) {
var style = new ol.style.Style({
image: new ol.style.Circle({
radius: 6,
stroke: new ol.style.Stroke({
color: 'white',
width: 2
}),
fill: new ol.style.Fill({
color: 'green'
})
})
});
return [style];
}assets folder, yours will look different if you downloaded new data:
Great, we've replaced the automatic style extracted from the KML file with a simple one driven by a style function. Our style function returns an array containing our simple circle style. If you have been paying attention, you should have noticed that our style function is not at all efficient—we are creating a new copy of exactly the same style for every single feature! Don't worry though, this is a temporary state that we'll fix shortly by generating a unique style for each feature, based on its photo and we'll add caching when we do.