Skip to main content

mapstyler_mapbox_adapter 0.1.0 copy "mapstyler_mapbox_adapter: ^0.1.0" to clipboard
mapstyler_mapbox_adapter: ^0.1.0 copied to clipboard

Mapbox GL Style adapter for the mapstyler ecosystem. Converts Mapbox styles to and from mapstyler_style types.

mapstyler_mapbox_adapter #

Converts Mapbox GL Style JSON into mapstyler_style types and back. Uses mapbox4dart internally for JSON parsing — that dependency is not exposed in the public API.

Part of the mapstyler ecosystem.

Features #

  • MapboxStyleAdapter — parses Mapbox GL Style JSON directly into mapstyler types and writes styles back to Mapbox JSON.
  • Layer mapping — fill, line, circle, symbol (text + icon splitting), raster.
  • Expression MVP — get, literal, interpolate, step, case, match, concat, zoom.
  • Filter MVP — ==, !=, <, >, <=, >=, all, any, none, !, has, !has, in, !in (legacy v1 + expression v2).
  • Zoom ↔ ScaleDenominator — Web Mercator conversion.
  • Unsupported layers — background, fill-extrusion, hillshade, heatmap, sky produce warnings.

Pure Dart — no Flutter dependency.

Usage #

import 'package:mapstyler_mapbox_adapter/mapstyler_mapbox_adapter.dart';
import 'package:mapstyler_style/mapstyler_style.dart';

final adapter = MapboxStyleAdapter();
final result = await adapter.readStyle(mapboxJson);

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');
  }
}

Writing Mapbox JSON #

final result = await adapter.writeStyle(style);

if (result case WriteStyleSuccess(:final output)) {
  print(output); // Mapbox GL Style JSON string
}

License #

MIT — see LICENSE.

0
likes
160
points
8
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Mapbox GL Style adapter for the mapstyler ecosystem. Converts Mapbox styles to and from mapstyler_style types.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

mapbox4dart, mapstyler_style

More

Packages that depend on mapstyler_mapbox_adapter