1

After I created a map in OpenLayers 3 (with GeoServer), when I zoomed it out, it duplicated all layers as you can see in the following example:

http://openlayers.org/en/v3.2.1/examples/drag-rotate-and-zoom.html

I don't want the user to be able to drag the map left/right till infinity.

How can I set the extent (to the whole world) so I will not see the duplicated layers?

2
  • By setting maxZoom. Have you read the docs Dec 28, 2015 at 9:56
  • set maxZoom/minZoom does not resolve the problem. you can still drag the map to the right/left with no limit
    – Tal Attar
    Dec 28, 2015 at 10:27

1 Answer 1

1

Consider using the wrapX:false parameter during layer source initialisation. For the specific example you mentioned this is not possible as Mapquest tile layer does not use such attribute. But for OSM, Bing and any wms tile source your task can be achieved using the wrapX:false parameter.

1
  • happy xmas amigo!!!!!
    – pavlos
    Dec 28, 2015 at 11:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.