O'Reilly logo

OpenLayers 3 : Beginner's Guide by Erik Hazzard, Paul Spencer, Thomas Gratier

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a thumbnail style

We can use OpenLayer's icon style to display an image, we just need the URL to the photo. We can use the JavaScript console to take a quick look at what data is associated with each feature, so that we can figure out where the URL is stored. With the previous example running in your browser, open the JavaScript console and type the following commands:

var feature = flickrSource.getFeatures()[0];
feature.getProperties();

This gets the first feature from the vector source and displays its properties, which should show you something like the following screenshot:

Creating a thumbnail style

Switch to JSON

Well, that wasn't as useful as we'd hoped. The URL ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required