react-leaflet
react-leaflet copied to clipboard
How to handle Error of (404 Not Found) leaflet offline Map tiles fetching
I have developed application using react-leaflet map and i have incorporated offline map tiles
<TileLayer attribution='© <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
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