XYZ Maps Documentation
    Preparing search index...

    Interface PreProcessorPipelineOptions

    Preprocess remote data in optional worker and main-thread phases before ingestion.

    Worker stages run sequentially after download/parse in the same provider worker. Only their final result is transferred to the main thread, where main stages run sequentially; there are no per-stage workers or transfers back to the worker. Omitted phases, empty arrays, and {} are identity configurations.

    Worker phases require the automatically selected HTTP/GeoJSON worker loader; they are not supported with a custom loader. Main-only pipelines support custom loaders. Invalid stages or mixing pipeline fields with single-worker fields throw. Processor exceptions and rejected Promises fail the tile request.

    preProcessor: {
    worker: {
    processor: ({data}, {options}) => data.filter(
    (feature) => feature.properties.population >= Number(options.minPopulation)
    ),
    options: {minPopulation: 1000}
    },
    // labelFor is an existing main-thread closure.
    main: ({data}) => data.map((feature) => ({
    ...feature,
    properties: {...feature.properties, label: labelFor(feature)}
    }))
    }
    interface PreProcessorPipelineOptions {
        main?: PreProcessor | PreProcessor[];
        worker?: WorkerPreProcessorStage | WorkerPreProcessorStage[];
    }
    Index

    One main-thread function or a list, each receiving the previous stage's result. Functions may use existing closures and receive data, tile, provider, and ready. Return the feature array or a Promise of it, or return undefined and call ready(features) when callback-style asynchronous work completes. The first stage receives the worker result, or loaded data when worker is omitted.

    One worker stage or a list, each receiving the previous stage's result. Use a self-contained function, a module URL with a default-exported processor, or WorkerPreProcessorStageOptions to supply structured-cloneable context.options. context.utils provides worker-safe helpers. Worker functions cannot access main-thread closures or APIs. ArrayBuffers, typed-array buffers, and ImageBitmaps in the final result are transferred (detaching worker-side resources); Blobs are structured-cloned.