flutter_map_rastercoords 0.0.1 copy "flutter_map_rastercoords: ^0.0.1" to clipboard
flutter_map_rastercoords: ^0.0.1 copied to clipboard

Flutter map utility library for non-geographic map projections using CRS Simple

flutter_map_rastercoords #

A flutter_map plugin for plain image map projection to display large images using tiles generated with gdal2tiles.

Inspired from leaflet-rastercoords.

Features #

  • Provides utilities to convert between pixel coordinates and LatLng.
  • Helper method to set up flutter_map option such as getMaxBounds

Usage #

  1. Add flutter_map_rastercoords to your pubspec.yaml:

    dependencies:
      flutter_map_rastercoords: ^0.0.1
    
  2. Create RasterCoords instance:

      final rc = RasterCoords(width: 1280, height: 1280);
    
  3. On your FlutterMap:

    Widget build(BuildContext context) {
      return FlutterMap(
           options: MapOptions(
           // for non-geographical maps
           crs: CrsSimple(),
           // initialize with map on center
           initialCenter: rc.pixelToLatLng(x: 1280 / 2, y: 1280 / 2), 
           // optimal zoom
           maxZoom: rc.zoom,
           minZoom: 1,
           initialZoom: 1,
             // set max bounds 
             cameraConstraint: CameraConstraint.containCenter(
               bounds: rc.getMaxBounds(),
             ),
           ),
        children: [
          TileLayer(
            urlTemplate: 'http://localhost:8000/map_tiles/{z}/{x}/{y}.png',
          ),
        ],
      );
    }
    
3
likes
0
points
51
downloads

Publisher

verified publisherjereme.me

Weekly Downloads

Flutter map utility library for non-geographic map projections using CRS Simple

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, flutter_map, latlong2

More

Packages that depend on flutter_map_rastercoords