react-leaflet icon indicating copy to clipboard operation
react-leaflet copied to clipboard

How to handle Error of (404 Not Found) leaflet offline Map tiles fetching

Open syncthreads-sammith opened this issue 9 months ago • 0 comments

I have developed application using react-leaflet map and i have incorporated offline map tiles <TileLayer attribution='&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' url={${process.env.PUBLIC_URL}/map/{z}/{x}/{y}.png} zoom={17} maxZoom={22} maxNativeZoom={19} /> here the map tiles are being fetched from this map folder so when i create build using npm run build i'll feed this tiles in the map folder Here the catch is i have limited area of map if i start navigating out off that map tiles which are available in map folder chrome console throws error saying Screenshot (10) actually its trying to fetch tiles which are not available, how do i handle this case, i need to stop fetching if tiles are not available and possibly show some alert message in UI

syncthreads-sammith avatar Sep 12 '23 09:09 syncthreads-sammith