PowerGeoJSONPolygons class
A utility class for loading and displaying polygons on a map from various sources.
The PowerGeoJSONPolygons class provides static methods for loading polygon data
from network sources, assets, files, memory, or directly from a string in GeoJSON format.
It also allows customizing polygon rendering through a builder function or polygon properties.
Example usage:
// Load polygons from a network source
PowerGeoJSONPolygons.network(
'https://example.com/polygon_data.geojson',
builder: (coordinates, properties) {
// Customize polygon rendering
return Polygon(
points: coordinates[0].map((point) => LatLng(point[1], point[0])).toList(),
// Add more polygon properties as needed
);
},
mapController: myMapController,
)
// Load polygons from an asset file
PowerGeoJSONPolygons.asset(
'assets/polygon_data.geojson',
polygonProperties: PolygonProperties(
fillColor: Colors.blue,
strokeColor: Colors.red,
),
)
// Load polygons from memory data
PowerGeoJSONPolygons.memory(
myGeojsonData,
polygonCulling: true,
)
// Load polygons from a string in GeoJSON format
PowerGeoJSONPolygons.string(
'{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[...]]}}',
mapController: myMapController,
)
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
asset<
T extends Object> (String url, {Key? key, bool polygonCulling = false, Polygon< T> builder(List<List< coordinates, Map<LatLng> >String, dynamic> ? map)?, PolygonProperties<T> ? polygonProperties, MapController? mapController}) → Widget - Loads and displays polygons from an asset file on a map.
-
file<
T extends Object> (String path, {Key? key, bool polygonCulling = false, PolygonProperties< T> ? polygonProperties, Future<String> fileLoadBuilder(String)?, Polygon<T> builder(List<List< coordinates, Map<LatLng> >String, dynamic> ? map)?, MapController? mapController, Widget fallback()?}) → Widget - Loads and displays polygons from a file on a map.
-
memory<
T extends Object> (Uint8List bytes, {Key? key, bool polygonCulling = false, PolygonProperties< T> ? polygonProperties, Polygon<T> builder(List<List< coordinates, Map<LatLng> >String, dynamic> ? map)?, MapController? mapController}) → Widget - Loads and displays polygons from memory data on a map.
-
network<
T extends Object> (String url, {Client? client, List< int> statusCodes = const <int>[200], Map<String, String> ? headers, Key? key, bool polygonCulling = false, Polygon<T> builder(List<List< coordinates, Map<LatLng> >String, dynamic> ? map)?, PolygonProperties<T> ? polygonProperties, MapController? mapController, Widget fallback(int? statusCode)?}) → Widget - Loads and displays polygons from a network source on a map.
-
string<
T extends Object> (String data, {Key? key, bool polygonCulling = false, Polygon< T> builder(List<List< coordinates, Map<LatLng> >String, dynamic> ? map)?, PolygonProperties<T> ? polygonProperties, MapController? mapController}) → PolygonLayer<T> - Loads and displays polygons from a string in GeoJSON format on a map.