georaster-layer-for-leaflet icon indicating copy to clipboard operation
georaster-layer-for-leaflet copied to clipboard

enable injection of proj4

Open DanielJDufour opened this issue 4 years ago • 1 comments

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.

DanielJDufour avatar Dec 21 '20 02:12 DanielJDufour

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; } };

kakharmanov avatar Nov 01 '24 07:11 kakharmanov