JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 55
  • Score
    100M100P100Q69299F
  • License ISC

Plugin for React Leaflet. Replaces missing tiles by scaled lower zoom Tiles.

Package Exports

  • react-leaflet-fallback
  • react-leaflet-fallback/react-leaflet-fallback.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-leaflet-fallback) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

# react-leaflet-fallback-tile-layer

react-leaflet-fallback-tile-layer is a plugin that provides a fallback tile layer implementation for [React Leaflet](https://react-leaflet.js.org/) maps. It allows you to load lower scaled tile images when originals are not found.
## Installation

You can install the package via npm:

```bash
npm install react-leaflet-fallback-tile-layer

Usage

Here's an example of how to use the FallbackTileLayer component:

import React from 'react';
import { FallbackTileLayer } from 'react-leaflet-fallback-tile-layer';

// Inside your component
const MyMapComponent = () => {
  return (
    <FallbackTileLayer
      zoom={10}
      minZoom={1}
      maxZoom={15}
      maxNativeZoom={15}
      attribution='&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
      url="/api/map_tiles/4uMaps/{z}/{x}/{y}.png"
      fallbackTileUrl="/api/map_tiles/4uMaps/{z}/{x}/{y}.png" // Fallback tile URL
      errorTileUrl="/api/map_tiles/error.png" // Error tile URL
    />
  );
};

export default MyMapComponent;

Replace the url and fallbackTileUrl properties with your own tile URLs. You can also customize other properties such as zoom, minZoom, maxZoom, and attribution according to your needs.

Contributing

Contributions are welcome! If you find any issues or want to add new features, feel free to submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.