I am trying to create a WMTS layer in OpenLayers with the following properties:

I am using the projection definition from http://epsg.io/5514 (the default one).

The resulting tiles contain two layers: 1 positioned correctly and another one in the wrong position. Does anyone have idea why is this happening?

enter image description here

Here is also a codepen that I have created https://codepen.io/bampakoa/pen/yWyLog


Strange effects can be produced by some reprojections. This is the world with 2 Europes and Africas when projected in EPSG:5514

enter image description here

A simple workaround would be to limit the EPSG:3857 extent of your EPSG:5514 layer when it is reprojected to EPSG:3857

  new ol.layer.Tile({
    opacity: 1,
    extent: ol.proj.transformExtent([10,40,30,60],'EPSG:4326','EPSG:3857'),
    source: new ol.source.WMTS(/** @type {!olx.source.WMTSOptions} */ (options))
  • 1
    Actual extent for EPSG 4326 is [12.09, 47.73, 22.56 ,51.06] (see epsg.io/5514). – TomazicM May 6 '19 at 12:03
  • @TomazicM In some cases a buffer may be useful. Maps sometimes go beyond the defined extent of their projection, e.g. overview maps in EPSG:27700 epsg.io/27700 are usually extended west into negative coordinates to include the whole of Ireland – Mike May 6 '19 at 16:11
  • Thanks, I'll keep that in mind. – TomazicM May 6 '19 at 16:14

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.