FMTC Docs
Project Links💝 Support Me
v9
v9
  • flutter_map_tile_caching
  • ❔Is FMTC Right For Me?
  • 💝Supporters
  • 📃(Proprietary) Licensing
  • 🚀Get Started
    • Quickstart
    • Installation
    • Example Application
    • v8 -> v9 Migration
    • Full API Reference
  • 🌐General
    • Initialisation
    • Backends
    • Error Handling
    • Tips
  • 📂Stores & Roots
    • Introduction
    • Stores
      • Management
      • Statistics
      • Metadata
    • Roots
      • Statistics
      • Recovery
    • flutter_map Integration
  • 📲Bulk Downloading
    • Introduction
    • 1️⃣Create A Region
    • 2️⃣Prepare For Downloading
    • 3️⃣Start Download
    • Control Downloads
    • Testing Tile Server
  • 🗃️External
    • Introduction
    • Exporting
    • Importing
  • flutter_map Docs
Powered by GitBook

© Luka Stillingfleet (JaffaKetchup)

On this page

Was this helpful?

Export as PDF
  1. Bulk Downloading

Create A Region

PreviousIntroductionNextPrepare For Downloading

Last updated 10 months ago

Was this helpful?

Regions (BaseRegions) are geographical areas that do not yet have any of the necessary extra information to start a download (this is the responsibility ofDownloadableRegion).

There are 4 types of BaseRegion:

RectangleRegions are defined by a LatLngBounds: two opposite LatLngs.

final region = RectangleRegion(
    LatLngBounds(LatLng(0, 0), LatLng(1, 1)),
);

This is usually all you get from most apps, so why not give your user a unique experience with some of our other region types...

CircleRegions are defined by a center LatLng and radius in kilometers.

final region = CircleRegion(
    LatLng(0, 0), // Center coordinate
    1, // Radius in kilometers
);

If you instead have two coordinates, one in the center, and one on the edge, you can use method, as below:

final centerCoordinate = LatLng(0, 0); // Center coordinate
final region = CircleRegion(
    centerCoordinate,
    const Distance(roundResult: false).distance(
        centerCoordinate,
        LatLng(1, 1), // Edge coordinate
    ) / 1000; // Convert to kilometers
);

LineRegions are defined by a list of LatLngs, and a radius in meters.

This could be used to download tiles along a planned travel route, for example hiking or long-distance driving. Import coordinates from a routing engine, or from a GPX/KML file for maximum integration!

final region = LineRegion(
    [LatLng(0, 0), LatLng(1, 1), ...], // List of coordinates
    1000, // Radius in meters
);

This region may generate more tiles than strictly necessary to cover the specified region. This is due to an internal limitation with the region generation algorithm, which uses rectangles to approximate the actual desired shape.

This type of region may consume more memory/RAM when generating tiles than other region types.

final region = CustomPolygonRegion(
    [LatLng(0, 0), LatLng(1, 1), ...], // List of coordinates
);

Polygons should not contain self-intersections. These may produce unexpected results.

Holes are not supported.

RecoverableRegions aren't technically the same type of region as the others, and is the odd one out.

However, it can be converted to a downloadable region in the same way as the others, or the original BaseRegion extracted using toRegion.

For more info, see Recovery.

CustomPolygonRegions are defined by a list of LatLngs defining the outline of a .

📲
1️⃣
'latlong2's Distance.distance()
simple polygon