mapstyler_sld_adapter 0.1.1
mapstyler_sld_adapter: ^0.1.1 copied to clipboard
SLD adapter for the mapstyler ecosystem. Maps flutter_map_sld types to and from mapstyler_style types.
mapstyler_sld_adapter #
Converts SLD XML into mapstyler_style types. Uses flutter_map_sld internally for XML parsing — that dependency is not exposed in the public API.
Part of the mapstyler ecosystem.
Features #
- SldStyleParser — parses SLD XML directly into mapstyler types.
- SLD read — flattens the SLD hierarchy (Layer → UserStyle → FeatureTypeStyle → Rule) into mapstyler rules.
- Symbolizers — PointSymbolizer (Mark / ExternalGraphic), LineSymbolizer, PolygonSymbolizer, TextSymbolizer, RasterSymbolizer.
- Filters — OGC comparison, combination, negation, spatial, and distance filters.
- Color conversion — ARGB integers ↔
#rrggbbhex strings with opacity support.
Pure Dart — no Flutter dependency.
Usage #
import 'package:mapstyler_sld_adapter/mapstyler_sld_adapter.dart';
import 'package:mapstyler_style/mapstyler_style.dart';
final parser = SldStyleParser();
final result = await parser.readStyle(sldXml);
if (result case ReadStyleSuccess(:final output, :final warnings)) {
print('Style: ${output.name}');
for (final rule in output.rules) {
print(' ${rule.name}: ${rule.symbolizers.length} symbolizers');
}
}
Color utilities #
argbToHex(0xFFFF0080); // → '#ff0080'
argbToOpacity(0x80FF0000); // → 0.502…
hexToArgb('#ff0080'); // → 0xFFFF0080
hexToArgb('#ff0000', opacity: 0.5); // → 0x80FF0000
License #
MIT — see LICENSE.