Open JeroenVerstraelen opened 1 year ago
The cellsize could be the issue: it is in degrees, while you'll need one in meters to work with webmercator.
The issue does appear to be because of PyramidFactory.maxSpatialResolution, currently the code uses the max spatial resolution specified in layercatalog.json:
val faparPyramidFactory = new PyramidFactory(
openSearchClient, "", netcdfVariables, "",
maxSpatialResolution = CellSize(0.008928571428584,0.008928571428569)
)
Which then causes FileLayerProvider.maxZoom to be wrong:
val maxZoom: Int = layoutScheme match {
case z: ZoomedLayoutScheme => z.zoom(0, 0, maxSpatialResolution)
case _ => 14
}
Here it uses ZoomedLayoutScheme(WebMercator).zoom(0, 0, CellSize(0.008928571428584,0.008928571428569)) = 26. So it is calculating a zoom level in WebMercator using a CellSize in EPSG:4326 which creates a zoom level that is too high for the native resolution of the layer.
The solution would be to edit the maxZoom calculation to take into account the CRS of maxSpatialResolution (= native CRS of the layer) and convert that resolution to WebMercator first.
When merging the old CglsPyramidFactory into file.PyramidFactory (previously Sentinel2PyramidFactory) I noticed an error when testing pyramid_seq (CglsPyramidFactoryTest#pyramid_seqExtent).
The actual crs of NETCDF:/data/MTDA/BIOPAR/BioPar_FAPAR_V2_Global/2020/20200110/c_gls_FAPAR-RT6_202001100000_GLOBE_PROBAV_V2.0.1/c_gls_FAPAR-RT6_202001100000_GLOBE_PROBAV_V2.0.1.nc:FAPAR is 4326. But pyramid_seq uses a ZoomedLayoutScheme with WebMercator as CRS, which causes GDALWarpOptions.targetCRS=WebMercator in the FileLayerProvider. When rastersource.cellType is called, it results in this error:
You can test this issue using: