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

Time for action – switching to JSON data

We mentioned earlier that the Flickr feed API supports more than just the KML format. It also supports a variety of RSS versions and JSON. That sounds promising; let's see if we can do better with the JSON version. Refer to the following steps:

  1. First, replace the KML source, flickrSource, with a generic vector source. Reload the page and make sure that everything still works. You should see the base map but no features (we'll add them shortly):
    var flickrSource = new ol.source.Vector();
  2. Next, we'll need to download the JSON version of our data by changing the format in the URL to json. Load the following URL in your browser and save the result to a new file called flickr_data.json:

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