Skip to main content

Custom protocols for source URLs

Shared GeoJSON data URLs, vector/raster/raster-dem TileJSON urls, georeferenced image url/updateImage and video urls now accept hierarchical custom addresses validated by the shared planner. Capability customSourceResourceURLs is true. HTTP(S), inline data and explicit-frame paths remain compatible.

map.addSource('data',{type:'geojson',data:'memory://assets/data.json'});
map.addSource('imagery',{type:'raster',url:'memory://assets/tiles.json'});
map.addSource('photo',{type:'image',url:'memory://assets/photo.png',
 coordinates:[[-10,10],[10,10],[10,-10],[-10,-10]]});
map.addSource('video',{type:'video',urls:['memory://assets/clip.mp4'],
 coordinates:[[-10,10],[10,10],[10,-10],[-10,-10]]});
await map.sqs.flush();
// Wait for sourcedata/error; flush does not mean URL resources are ready.

Hosts own handler registration and resource delivery. Web hosts register addProtocol in the map's realm; independent Workers register themselves, with no automatic main-thread function forwarding. C hosts deliver JSON, TileJSON, PNG/JPEG/WebP or supported MP4/H.264 encoded bytes and respond using original generation/id. The core gains neither a network client nor a spatial-engine dependency.

Scheme syntax, credential/host checks, deadlines, concurrency and byte limits follow shared planning. Custom plans have no automatic HTTP retries/fallbacks and use no-store. Decoder budgets are unchanged: GeoJSON8MiB, TileJSON1MiB, images4MiB and video64MiB; format/pixel bounds remain in their guides. Missing handlers must return explicit errors instead of empty-data success.

Source instance, data revision and request generations retain their existing validation. Late responses are rejected. A URL update does not imply decode completion; use sourcedata/error and loading state. Queries, filtering, playback, attribution and ordering retain their contracts, including generateId replacement and stable-ID state rules.

Style URL, glyph service, standalone loadImage and live HTTP/WS entries retain their own existing protocol restrictions. File/data/blob schemes are not opened. Native QuickJS addProtocol callbacks, independent 3D downloaders, mobile GIS/iOS and devices remain separate work.

The portable script loads four actual resource types and verifies updates through seven identical native C/browser main-thread/Worker checks and video pixels. The complete page includes byte handlers and Worker bootstrap; fixtures are generated or retain their existing license.

Shared tile URL templates extend quadkey, bbox, prefix, ratio and actual density changes. Earlier batch evidence remains historical; full source parameters remain separately pending.