Creating a WebGL map

In the first example, called ch07_webgl, we will create our first WebGL map. We bring our application to its limits, displaying more than 200,000 points on a single map. If you haven't performed this test already, you must be thinking that the magnitude of features will render our application totally unresponsive and useless. Let's make an attempt to perform this test, though. For this example, we only have to modify our map constructor using our new vector layer and the WebGL renderer:

var map = new ol.Map({ target: 'map', layers: [ […] new ol.layer.Vector({ source: new ol.source.Vector({ format: new ol.format.GeoJSON({ defaultDataProjection: 'EPSG:4326' }), url: '../../res/switzerland_points_osm.geojson', attributions: [ ...

Get Mastering OpenLayers 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.