stuartmatthews / leaflet-geotiff

Leaflet plugin for displaying geoTIFF raster data
MIT License
174 stars 76 forks source link

ReferenceError: GeoTIFF is not defined #40

Closed Gaetanbrl closed 9 months ago

Gaetanbrl commented 9 months ago

Version

Version : v8.1.0 Load : from release dist/ol.js inside index.html (old school import style)

Description

Hi, I try to use OL 8.1.0 to view a simple TIFF file.

If i use openlayers as Vite dependancy (start serve with NPM), it works.

But if i load OpenLayers from ol.js file without NPM, i get an error : ReferenceError: GeoTIFF is not defined

    <script
        type="text/javascript"
        src="lib/openlayers/8.1.0/ol.js"
    ></script>

When i debug ol lib, i can find ol.source.GeoTIFF function :

image

Here is the code inspired by OL examples :

const layer = new ol.layer.WebGLTile({
    source: new ol.source.GeoTIFF({
        convertToRGB: true,
        sources: [
            {
                url: 'xxxx_RVB_COG.tif',
            },
        ],
    }),
});

Do you reproduce this behavior ? Need i to import GeoTIFF lib before ol in v8.x ?

Thanks.

GB

Gaetanbrl commented 9 months ago

Wrong repo (wrong brower tab...). I close, sorry !