addCustomGeometrySource method

Future<CommandCompletion> addCustomGeometrySource(
  1. String sourceId,
  2. CustomGeometrySourceOptions options
)

Adds a source whose GeoJSON tiles come from callbacks.

See mln_map_add_custom_geometry_source in the C API reference.

Errors:

  • Status.alreadyExists when the style already has a source named sourceId.
  • Status.invalidState while the style isn't loaded, as MapHandle.setStyleUrl() describes.

Implementation

Future<CommandCompletion> addCustomGeometrySource(
  String sourceId,
  CustomGeometrySourceOptions options,
) => _command((arena, completion) {
  final registrations = _NativeRegistrations(_callbackRoots);
  return registrations.run(
    () => raw.mln_map_add_custom_geometry_source(
      _handle.raw,
      nativeStringView(sourceId, arena).value,
      registrations.add(
        _prepareCustomGeometrySourceOptions(options, registrations.roots),
      ),
      completion,
      nativeDiagnostic,
    ),
  );
});