Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

To disable world wrapping #1864

Closed
SemiHum opened this Issue · 0 comments

1 participant

@SemiHum

Hi,
I'm developing a indoor map with OL3. In my case, I don't need to repeat the world out side [-180,180].
In OL2, I can achieve my goal with following code.

var map = new OpenLayers.Map('map');
var imageLayer = new OpenLayers.Layer.XYZ('imageLayer',
    'api/map_image/3F/${z}/${x}_${y}.jpg', {
    sphericalMercator: true,
    numZoomLevels:4,
    tileOptions: {
        eventListeners: {
            'loaderror': function(evt) {
                console.log(evt);
            }
        }
    }
});
map.addLayers([imageLayer]);
map.zoomToMaxExtent();

In OL3, I tried with following code but images repeat in horizon.

var map = new ol.Map({
    target: 'map',
    layers: [
        new ol.layer.Tile({
            source: new ol.source.XYZ({
                url: 'api/map_image/3F/{z}/{x}_{y}.jpg',
            }),
        })

    ],
    renderer: 'canvas',
    view: new ol.View2D({
        center:[0,0],
        zoom: 1,
        maxZoom:4,
    })
});

Is there any suggestion to show single copy of the map?

Thanks.
Best Regards.
SemiHum

And Tom Payne replied following in Google Group
Right now, this is hardcoded into ol.source.XYZ. It shouldn't be.

Please open an issue on GitHub for this.

(detailed answer: world wrapping is currently implemented using a TileCoordTransform, it should be possible to disable this)

@twpayne twpayne closed this in #1868
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.