Код для загрузки геотифа примерно выглядит так:
Код: Выделить всё
this.modelLayerSource = new GeoTIFF({
projection: 'EPSG:4326',
interpolate: true,
normalize: false,
sources: [
{
url: this.modelService.getModelFileUrl(c),
bands: [1]
},
],
});
if (!this.modelLayer) {
this.modelLayer = new TileLayer({
style: {
color: [
'interpolate',
['linear'],
['band', 1],
2,
[255, 255, 255],
2.5,
[4,90,141]
]
},
source: this.modelLayerSource
});
}
this.modelLayer.setSource(this.modelLayerSource);
if (!this.map.getLayers().getArray().includes(this.modelLayer)) {
this.map.getLayers().insertAt(1, this.modelLayer);
}
this.modelLayer.changed();
this.modelLayerSource.refresh();
useGeographic();
proj4.defs("EPSG:32718","+proj=utm +zone=18 +south +datum=WGS84 +units=m +no_defs +type=crs");
proj4.defs("EPSG:3857","+proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs +type=crs");
proj4.defs("EPSG:4326","+proj=longlat +datum=WGS84 +no_defs +type=crs");
register(proj4);
this.map = new Map({
target: this.myMap.nativeElement,
layers: [
this.osmLayer,
this.vectorLayer
],
view: new View({
projection: 'EPSG:3857'
// center: fromLonLat([-76.2591842, -6.5692892]),
// zoom: 6
}),
});
< /code>
Результат выглядит так (игнорируйте цветные круги и серы С большой белой границей "src =" https://i.sstatic.net/ivzsavij.png "/>
Вот еще один скриншот из qgis с тем же файлом:
Как я могу избавиться от большого белого граница вокруг геотифа в Openlayers?
Подробнее здесь: https://stackoverflow.com/questions/793 ... rge-border