Map Viewers: Main Open Source Libraries
In this article, we discuss the most common libraries available to represent data with a spatial component, including CesiumJS, OpenLayers, and Leaflet.
Join the DZone community and get the full member experience.
Join For FreeIntroduction
Today we want to bring you a series of blog entries somewhat different from what we are used to: we are going to talk about maps; or rather about the most common libraries that are currently available to represent data with a spatial component. We are sure you are already familiar with that, and also with what you need to do to make your first map.
Main libraries
There are as many libraries to make maps as there are colors. There are viewers programmed in C#, Java, Python, JavaScript, etc., which can be executed in different environments, including desktop, mobile and web.
Therefore, depending on the purpose we have, we will between a library and environment. But as we cannot talk about all of them (although we would like to) we have decided to limit ourselves to those libraries that:
- Are developed in JavaScript
- Run in browsers
- Allow the carrying out of some spatial analyses
- Are Open Source (and therefore, free)
With this we have filtered the possible options, so let’s see which ones we’ll keep.
CesiumJS
We start talking about this library because it is the one we currently use in the Platform’s GIS Viewers. Cesium is an Open Source library, under the Apache license, designed to create 2D, 2.5D, and 3D maps globally, with good performance, accuracy, visual quality, and ease of use.
This library has a great advantage over other options, and that is that it includes native 3D visualization, allowing us to view content in three dimensions, use extruded models, etc. Simplifying a lot, it is the closest to Google Maps that we are going to find.
Here is the web link and the GitHub link.
OpenLayers
We give this library the second place because, although we have not yet implemented it in GIS Viewers, we make fairly widespread use of it in both Products and Projects
Like Cesium, OpenLayers is an Open Source library, with a BSD-2 license. This differs mainly from the previous one in that the visualization is exclusively in 2D, although there is a plugin that allows adapting the Cesium library to give 3D capabilities to OpenLayers.
Being focused on 2D, it has a greater potential in terms of projected coordinate systems, so that, while in Cesium only two coordinate systems are supported (the ones called WGS84 and Pseudo-Mercator), with OpenLayers you can work with almost any coordinate system, either those defined by default or one of your own through PROJ4.
The main advantage of this is that it allows you to work with local geospatial files, focused on a specific area (for example, on the island of El Hierro (Canary Islands), using REGCAN95 27N).
Leaflet
This library is Open Source too, under the BSD-2 license, and is characterized by being much lighter than the two. Its drawback, as with Cesium, is that it has only four options of projection systems by default, so it is necessary to jury-rig with PROJ4 to represent local data.
This library is perfect to represent your data quickly and easily, without thousands of options making it difficult. Be careful with the order of the coordinates, which here are specified as latitude and longitude, unlike Cesium and OpenLayers, which do it as longitude and latitude.
Although it is a 2D viewer, there are plugins that allow you to enter 3D models or even display an isometric view.
Other Libraries
These would be the most common libraries to find and work with, but there are also some marginal libraries that, although they meet the same premises as the previous ones, are barely used. This would be the case with Polymaps, a very light library but not updated since 2011, or Modest Maps, which is barely 10KB in its minified mode.
In the following posts, we will explain how to install and start using these three map viewer libraries: Cesium, OpenLayers, and Leaflet.
Published at DZone with permission of Francisco Javier Lopez. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments