How to develop a Swipe tool for rasters or vectors (Spatial layer) like openlayers or ErdasImagine. Can any one give me the references please
Asked
Active
Viewed 207 times
-3
-
As per the [Tour] there should only be one question per question and by asking the same question for multiple products this is effectively multiple questions. – PolyGeo May 11 '16 at 10:18
1 Answers
3
In OpenLayers Swipe Control is easy enough to use, the following code should set you up:
var map;
var swipe;
function init() {
map = new OpenLayers.Map({
div : "map",
allOverlays : true
});
var osm = new OpenLayers.Layer.OSM();
var gmap = new OpenLayers.Layer.Google("Google Streets");
map.addLayers([ osm, gmap ]);
swipe = new OpenLayers.Control.Swipe(osm);
map.addControl(swipe);
map.setCenter(new OpenLayers.LonLat(10.2, 48.9).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()), 9);
}
function toggleControl(element) {
if (element.checked) {
swipe.activate();
} else {
swipe.deactivate();
}
}
Another example of swipe control in OpenLayers is this, and this.
This question is also a bit similar.
Hasan Mustafa
- 3,328
- 1
- 14
- 41
-
what is the function code for swipe.active() and swipe.deactive() ? – Satya Chandra May 11 '16 at 11:00