Now that we've got that sorted out, we should be able to create a thumbnail style for our photos reasonably easily:
As mentioned earlier, we will want to cache our feature styles. Add an empty object that can be used for this, just before our style function:
var cache = {};
We can use the URL to the photo as the key for our cache entries. Remove all the existing code in the
flickrStyle
function and replace it with the following:function flickrStyle(feature) { var url = feature.get('url'); if (!cache[url]) { cache[url] = new ol.style.Style({ image: new ol.style.Icon({ scale: 0.10, src: url }) }); } return [cache[url]]; }