publiclab / leaflet-tile-filter

Multispectral color manipulation and processing (NDVI etc) for Leaflet tile layers with pure JavaScript in Image Sequencer
https://publiclab.github.io/leaflet-tile-filter/
GNU General Public License v3.0
6 stars 5 forks source link

Issue with classList and sample code #21

Open Chenart opened 5 years ago

Chenart commented 5 years ago

Hi Public Lab team!

Problem

When I use the leaflet-tile-filter sample code in my React app, I get the following compile error: ''TypeError: Cannot read property 'classList' of undefined", which occurs in leaflet.tile-filter.js

Here is an image of the full error dump: image

Attempted Fix

I commented out the code (lines 9 and 10 in the source code) to avoid the error, and this does allow my app to compile. However, I have a feeling that this breaks other functionality of leaflet.tile-filter, because the 'ndvi' filter is not showing up.

I also tried testing on the index.html file sample code in the node module, but I get a page that doesn't render the map.

Environment:

I'm using the latest version of Chrome on Windows, and I'm using React with Webpack. I am using vanilla Leaflet, however, not react-leaflet.

As well, I have imported jquery and image-sequencer as dependencies.

Would you have any ideas as to why this error would be occurring, and how I might fix it? Thank you for your help!

jywarren commented 5 years ago

Hi, thanks for posting the issue! Can you share any of your code so we can see what's going on? Indeed, this extra set of classes helps us track which tiles have been replaced with filtered tiles. So they are necessary. I'm not sure what is causing your tileLayer to be undefined, though! How are you setting this up?