GeoTIFF / georaster-layer-for-leaflet

Display GeoTIFFs and soon other types of raster on your Leaflet Map
https://geotiff.github.io/georaster-layer-for-leaflet-example/
Apache License 2.0
306 stars 58 forks source link

enable injection of proj4 #52

Open DanielJDufour opened 3 years ago

DanielJDufour commented 3 years ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

kakharmanov commented 1 month ago

Hi! I have problem with proj4, vue 3 composition api with js. That problem displays when i push my project into the server, in local machine everything is OK,

node.js 20

Снимок экрана 2024-11-01 в 12 45 24

import GeoRasterLayer from 'georaster-layer-for-leaflet'; import georaster from 'georaster';

const loadTiffLayer = async ( layer, link = import.meta.env.VITE_API_DEV + props.layer.link, token = localStorage.getItem('token'), ) => { if (isLoading.value) { return; }

isLoading.value = true;

try { const response = await fetch(link, { headers: { Authorization: Bearer ${token}, }, });

if (!response.ok) {
  throw new Error(`Error TIFF: ${response.statusText}`);
}

const arrayBuffer = await response.arrayBuffer();
const georasterData = await georaster(arrayBuffer);

tiffLayer.value = new GeoRasterLayer({
  georaster: georasterData,
  opacity: Number(layer.opacity),
  resolution: 256,
}).addTo(map.value);
currentLayer.value.push(tiffLayer.value);
map.value.fitBounds(tiffLayer.value.getBounds());

} catch (error) { console.log(error) } finally { isLoading.value = false; } };