Before getting started
As we will mainly focus on attribute management in this chapter, we will need a vector layer with lots of attributes. I have prepared such a layer to work with. It can be located in the res
folder of the code annex, and its name is world_countries.geojson
. Before we make some progress, let's change our default vector layer from the capitals of the world to this one:
var map = new ol.Map({ […] new ol.layer.Vector({ source: new ol.source.Vector({ format: new ol.format.GeoJSON({ defaultDataProjection: 'EPSG:4326' }), url: '../../res/world_countries.geojson', }), name: 'World Countries' }) ], […] });