HTTP and Custom Sources
Connect a compatible data service, use local readers, and manage provider and worker ownership.
Connect a compatible /domain/v2 service or a browser-local source. A provider adapts its data for rendering layers.
Connect HTTP Data
import { DataWorker, HttpDataSource, seismicImage } from '@bs/outkrop-core'
export async function createRemoteImage(baseUrl: string, path: string) {
const source = new HttpDataSource({
baseUrl,
fetch: (input, init) => fetch(input, { ...init, credentials: 'include' }),
})
const worker = new DataWorker()
try {
const info = await source.seismicInfo(path)
const image = seismicImage(source, info, { worker, ops: { agc: 250 } })
return { source, info, image, worker }
} catch (error) {
worker.dispose()
throw error
}
}
The caller retains the worker while the image is used and disposes it afterward. Supply your app’s authenticated fetch; cross-origin services need CORS. This source expects the Outkrop service contract, not a raw SEG-Y download URL.
Choose a Provider
| Provider | Supplies |
|---|---|
seismicImage |
Tiled seismic grid |
sectionImage |
Whole-trace gain/taper processing and histograms |
windowImage |
Selected trace/sample window |
wellCurves |
Scalar curve chunks and envelopes |
wellArrayImage |
Supported well array channel |
arrayImage |
A trace-major Float32Array |
Local or Hosted, Same View
flowchart TD
accTitle: Use the same rendering views with different data sources
accDescr: A React view or core layer uses a provider. Providers can request data from an HTTP source or a browser-local source. A core data worker can decode and process HTTP tiles.
View["React view or core layer"] --> Provider["Provider"]
Provider --> HTTP["HttpDataSource"]
Provider --> Local["LocalDataSource"]
HTTP --> Service["Compatible service"]
Local --> File["File worker and browser file"]
Provider <--> Worker["Optional core DataWorker"]
LocalDataSource supplies seismic tiles and scalar curves without HTTP. It does not supply well array tiles or dispatcher tie windows.
Handle Changes and Ownership
| Situation | Your action |
|---|---|
DataError.status === 409 |
Drop stale data, reload metadata and rebuild providers; SectionView handles its reload |
Transferring buffers to DataWorker |
Treat them as consumed; copy first if you must retain originals |
| View unmounts | Dispose the worker when no other view uses it |
| No Worker implementation | Core worker can run inline; local sessions still require browser workers |
DataWorker starts lazily. Keep it stable between renders. The contract is exported at @bs/outkrop-core/contract/domain-v2.openapi.json.
For another backend, implement DataSource: match metadata/payloads, honor versions and cancellation, and reject unsupported capabilities. For format parsing alone, use ByteSource.