Catégories

One script, two maps !

Some may prefer ​Leaflet for design, plugins or lightweight. Some others may rather use ​OpenLayers for specific features or simple historical reasons. No matter the preferences, they are the best two open source javascript libraries for webmapping nowadays.

At GeoLabs we love and use both. As probably many, we would select one technology or the other according to our needs, according to projects or existing code. Of course we've been hacking OpenLayers for a while now (as it is the default library used in our ​MapMint platform), but we've also been increasingly using Leaflet for a few projects lately.

After using both APIs for some time, we thought that they aren't so different for creating simple web maps, like the one everybody needs with only few layers, basic navigation and simple controls. For such purpose, we found out that switching from one library to the other (and so playing with both APIs all the time) was kind of a waste of time and somehow just useless. We then started to think about how to wrap both, and how to forget about API differences, so we can focus on the map content and styles rather than on coding concerns.

Such an idea was recently implemented in the ​PublicaMundi Mapping API, and we'd like to show you a simple example here. The latter basically demonstrates how one can create an Openlayers map or a Leaflet map using the exact same javascript source code.

This example shows basic functionalities but additional features will soon be added to the PublicaMundi Mapping API such as the WFS LayerType or more advanced controls such as clustering or editing. ​View demo and check out ​PublicaMundi to learn more.

This work was supported by a grant from the European Union's 7th Framework Programme (2007-2013) provided for the project PublicaMundi (GA no. 609608).