power_geojson 3.38.9 copy "power_geojson: ^3.38.9" to clipboard
power_geojson: ^3.38.9 copied to clipboard

A Powerful tool for Geojson with flutter_map, styled from properties, supports esri json, soon supports multiple projection and coordinate systems

Flutter power_geojson #

pub package GitHub stars

Render GeoJSON (and Esri JSON) FeatureCollections on top of flutter_map with one-liners for markers, polygons, and polylines. Includes clustering, fallbacks, property-driven styling, and a tiny JSON helper for DateTime/Enum-safe serialization.

Highlights #

  • Markers, polygons, and polylines driven directly from GeoJSON/Esri JSON.
  • Load from network, assets, files, memory (Uint8List), or raw strings.
  • Built-in marker clustering via PowerMarkerClusterOptions and HTTP fallbacks.
  • Property-based styling through MarkerProperties, PolygonProperties, and PolylineProperties.
  • PowerJSON helper for safe JSON string building (DateTime, Enum, TimeOfDay).

Installation #

Add the dependency to your pubspec.yaml:

dependencies:
    power_geojson: ^3.38.9

Quick start #

import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong2/latlong.dart';
import 'package:power_geojson/power_geojson.dart';

class GeoMap extends StatelessWidget {
    const GeoMap({super.key});

    @override
    Widget build(BuildContext context) {
        return FlutterMap(
            options: const MapOptions(
                initialCenter: LatLng(33.59, -7.62),
                initialZoom: 11,
            ),
            children: [
                TileLayer(
                    urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
                    userAgentPackageName: 'com.example.power_geojson_example',
                ),
                PowerGeoJSONPolygons.asset(
                    'assets/polygons.geojson',
                    polygonProperties: PolygonProperties(
                        color: Colors.blue.withOpacity(0.2),
                        borderColor: Colors.blue,
                        borderStrokeWidth: 1.5,
                    ),
                ),
                PowerGeoJSONPolylines.network(
                    'https://example.com/lines.geojson',
                    polylineProperties: const PolylineProperties(
                        color: Colors.orange,
                        strokeWidth: 3,
                    ),
                    fallback: (status) => Text('Network error: $status'),
                ),
                PowerGeoJSONMarkers.network(
                    'https://example.com/points.geojson',
                    markerProperties: const MarkerProperties(height: 40, width: 40),
                    powerClusterOptions: PowerMarkerClusterOptions(
                        maxClusterRadius: 40,
                        builder: (context, markers) => const Icon(
                            Icons.location_on,
                            color: Colors.red,
                        ),
                    ),
                ),
            ],
        );
    }
}

Pick a data source #

  • Asset: PowerGeoJSONPolygons.asset('assets/polygons.geojson')
  • Network with fallback: PowerGeoJSONPolylines.network(url, fallback: (status) => Text('Status $status'))
  • File: PowerGeoJSONMarkers.file('/tmp/points.geojson', markerProperties: MarkerProperties(height: 32, width: 32))
  • Memory/String: PowerGeoJSONPolygons.memory(bytes) or PowerGeoJSONPolylines.string(jsonString)

PowerJSON quick helper #

final jsonText = PowerJSON({
    'id': 7,
    'timestamp': DateTime.now(),
    'role': UserRole.admin,
    'tags': ['geo', 'power'],
}).toText();

Documentation #

Full API docs live on pub.dev.

Changelog #

See CHANGELOG.md for recent updates.

Issues and contributions #

Contributions are welcome!

License #

This project is licensed under the MIT License - see LICENSE.

Checkout my other packages #

2
likes
150
points
69
downloads

Publisher

unverified uploader

Weekly Downloads

A Powerful tool for Geojson with flutter_map, styled from properties, supports esri json, soon supports multiple projection and coordinate systems

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

animated_stack_widget, collection, console_tools, enhanced_future_builder, flutter, flutter_map, flutter_map_marker_cluster, geodesy, geojson_vi, http, latlong2, provider

More

Packages that depend on power_geojson