iTowns / itowns

A Three.js-based framework written in Javascript/WebGL for visualizing 3D geospatial data
http://www.itowns-project.org
Other
1.09k stars 293 forks source link

Breaking tiles on ElevationLayer #1916

Open vladimir-rybalko opened 1 year ago

vladimir-rybalko commented 1 year ago

Your Environment

Context

I have 2 layers: ColorLayer - OSM and ElevationLayer - my raster layer. When I try to combine them, I get a break in the tiles.

image image image

Code available here

ElevationLayer is defined like this

const extent = new itowns.Extent('EPSG:4326', 29.0, 30, 60.0, 61);

const elevationSource = new itowns.WMSSource({
        extent,
        version: '1.3.0',
        name: 'GroundSpace:vuoksa_bridge',
        crs: 'EPSG:4326',
        format: 'image/png',
        url: './geoserver/GroundSpace/wms',
});

var elevationLayer = new itowns.ElevationLayer('wms_elevation', {
        source: elevationSource,
        useColorTextureElevation: true,
        colorTextureElevationMinZ: -15.55,
        colorTextureElevationMaxZ: 15.768,
});

view.addLayer(elevationLayer).then(
    debugMenu.addLayerGUI.bind(debugMenu)
);

How can I solve the broken tiles problem?

vladimir-rybalko commented 1 year ago

I found a solution to my problem by changing the FOV setting for the camera. To what extent is this decision correct?

  let k = 1;
  const width = window.innerWidth;
  const height = window.innerHeight;
  if (width > height) {
      k = width/height - 1;
  } else {
      k = height/width - 1;
  }
  k = k < 0.1 ? 0.15 : k;            
  view.camera.camera3D.fov += view.camera.camera3D.fov*k;
  view.camera.camera3D.updateProjectionMatrix();