[OpenLayers-Users] OpenLayers.Control.Swipe

Arnd Wippermann arnd.wippermann at web.de
Sun Feb 10 14:17:16 PST 2013


Hi,
 
cool control. 
 
Works great with Release 2.13 dev, but not with 2.12.
 
Have you an idea, what can cause the error?
 
TypeError: this.map.layerContainerOriginPx is undefined
var top = -this.map.layerContainerOriginPx.y;
Swipe.js (Zeile 402)

Arnd

  _____  

Von: openlayers-users-bounces at lists.osgeo.org
[mailto:openlayers-users-bounces at lists.osgeo.org] Im Auftrag von Cédric
MOULLET
Gesendet: Sonntag, 10. Februar 2013 06:07
An: Sergeant_york
Cc: openlayers-users at lists.osgeo.org
Betreff: Re: [OpenLayers-Users] OpenLayers.Control.Swipe


Hi,
A pure OpenLayers example can be shown here:
http://mf-chsdi0i.bgdi.admin.ch/main/wsgi/GeoAdmin.ux/Swipe/examples/openlay
ers_swipe.html

The source code is here: http://docs.google.com/uc?export=download
<http://docs.google.com/uc?export=download&id=0B_gmqEgDEiu5WGRGVDRQd281UVE>
&id=0B_gmqEgDEiu5WGRGVDRQd281UVE

Swipe can be used in the following way:

var map = new OpenLayers.Map("map");

var ol_wms = new OpenLayers.Layer.WMS(
    "OpenLayers WMS",
    "http://vmap0.tiles.osgeo.org/wms/vmap0",
    {layers: "basic"}
);

var dm_wms = new OpenLayers.Layer.WMS(
    "Canadian Data",
    "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap",
    {
        layers: "bathymetry,land_fn,park,drain_fn,drainage," +
                "prov_bound,fedlimit,rail,road,popplace",
        transparent: "true",
        format: "image/png"
    },
    {isBaseLayer: false, visibility: true}
);

map.addLayers([ol_wms, dm_wms]);
var swipe = new OpenLayers.Control.Swipe({map: map});
map.addControls([new OpenLayers.Control.LayerSwitcher(),swipe]);
swipe.activate();
map.zoomToMaxExtent();

Swipe control works also on mobile. 


Hope this helps,
Cédric






-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130210/b6c2f8c7/attachment.html>


More information about the Users mailing list