user1111527
user1111527

Reputation: 129

Problem with rendereing geotiff file in proper bounds with openlayers

I have the code in openlayers 6. which load the geotiff file - pacific.tif and in some viewers it says it has my projection WGS 84 (my openlayers projection is EPSG:4326).

which load the geotiff file - pacific.tif And in some viewers it says it has my projection WGS 84 (my openlayers projection is EPSG:4623).

  const projection = new Projection({
    code: 'EPSG:4326',
    worldExtent: [-180, 90, 360, -90],
    unit: 'degrees'
  });

  source = new GeoTIFF({
      sources: [
        {
          url: url,
          projection: projection,
          unit: 'degrees'
        },
      ],
      wrapX: true,
      normalize: false,
      interpolate: true,
      projection: 'EPSG:4326'
    })

Then in the code tile layer creation

import TileLayer from 'ol/layer/WebGLTile.js';


let view = await source.getView()

  let tileLayer = new TileLayer({
    visible: true,
    wrapX: true,
    source: source,
    extent: view.extent,
    style: geotiffCase
  })

which is added to map. And it uses the bounds I attached on picture. enter image description here

But it draw it from west to the east as view.extent = [ -80, -60, 119, 65], not from the east to the west crossing antimeridian. So the pacific.tif renders on atlantic ocean

I have tried to update in runtime source.getView().extent and source.getView().center where I put modified values (119 and 360-80 and it delta as center) and it code draw color in a proper place. but it is not the content of pacific.tif just my color for the empty value...

so how to fix the problem? Is it possible to solve it from openlayers side with proper settings or additional code?

link to the pacific.tif

Upvotes: 0

Views: 86

Answers (0)

Related Questions