[GIS] Comparing two maps with nice web interface

leafletopenlayers-2swipeweb-mapping

Is it possible in Leaflet or OpenLayers to compare two maps with a bar to slide between the two?

Examples include:

I know it's possible, I don't know how to do it though. Anyone got any ideas? Examples?

Best Answer

What you want to do, is usually called a 'Swipe' tool.

There is no inbuilt tool or control for this in OpenLayers, but thankfully, there is an example here: Swipe Control with Google and OSM based on a custom class.

You just need to include this JavaScript file in your application.

Most Swipe Tools/controls that I have seen online, are based on the simple CSS clip. It is very simple to integrate this kind of Control in your application even without external patches.

Related Question