This chapter shows us the basics and the important things that we need to know when we start creating our first web-mapping application with OpenLayers.
In contrast to other libraries, such as Leaflet (http://leafletjs.com), which focuses on a smaller download size in order to provide only the most common functionality as standard, OpenLayers tries to implement all the required things that a developer could need to create a web Geographic Information System (GIS) application.
OpenLayers 3 packs a smaller footprint than its predecessor and targets the latest HTML5 and CCS3 capabilities. The trade off, of course, is that legacy browsers will not be as fully featured (primarily, Internet Explorer lower than version 9). As the rate of modern browser adoption ever increases, this disadvantage will soon become a moot point.
The main concept in OpenLayers is, rightly, the map. It represents the view where information is rendered. The map can contain multiple layers, which can be raster or vector layers. Each layer has a data source that serves data with its own format: a
.PNG image, a
.KML file, and so on. In addition, the map can contain controls, which help interact with the map and its contents; these are pan, zoom, feature selection, and so on.
Let's get started with learning OpenLayers by examples.