Skip to main content

Shared MVT layers and queries

Vector sources now display standard circle,line,fill layers through addSource/addLayer. Each layer requires source-layer. Layers share downloads and cached content, with common geometry for planar,pitched and globe views. Planar rendering interleaves fills,lines and points in logical layer order: moveLayer can place a fill above a circle while retaining spatial-cell culling and LOD.

import {map} from 'sqsmap';
map.addSource('roads',{type:'vector',tiles:['https://your-server.example/{z}/{x}/{y}.pbf'],attribution:'Your provider'});
map.addLayer({id:'roads-line',type:'line',source:'roads','source-layer':'transportation',paint:{'line-color':'#e87925','line-width':3}});
await map.sqs.flush({render:true});
console.log(await map.querySourceFeatures('roads',{sourceLayer:'transportation'}));

Scheduling/cancellation reuse shared tile handling, including TileJSON,setTiles/setUrl,XYZ/TMS,world copies and attribution. Each MVT response permits8MiB,32 source layers,50,000 features and500,000 vertices. A map permits64 visible tiles,32 pending requests and64MiB decoded tile cache; visible source data additionally obeys16MiB JSON,50,000 features,500,000 coordinates and resident source budgets. Over-budget responses fail explicitly and failed refresh retains old content. Parent/child fallback is not connected; cached invisible tiles are excluded from queries.

querySourceFeatures requires sourceLayer. queryRenderedFeatures filters by display layer and returns sourceLayer,original MVT id and attributes, with WGS84 coordinates including visible world copies. Native/shared script reads use await. A feature may appear multiple times across tiles or world copies. GeoJSON/media sources cannot specify source-layer. metadataLoaded describes metadata; tileState and loaded describe actual current-view readiness.

vectorTileSourceStore=true represents this MVT subset, not complete vector style compatibility. Shared point image/text symbols and promoteId are implemented in subsequent stages. Fill-extrusion and other types,buffer-geometry tile-boundary clipping,MLT,parent/child fallback and the mobile host remain pending. Existing setStyle(URL) basemaps retain their separately documented scope.

The complete HTML includes every button,query,credit and disposal action. The portable acceptance script uses locally generated MVT through real native QuickJS and WASM main-thread/strict Worker. Replace the template and display required provider credits for real services.

Pitched views retain existing distance fog, which blends distant geometry toward the background. Acceptance records preserve actual pixels rather than requiring unlit solid RGB values.

MVT feature state is connected in07.9; see feature state.

Shared MVT promoteId (07.10)

A vector source accepts a property name or a sourceLayer-to-property mapping. A string applies to every source layer. A mapping overrides listed layers only;unlisted layers retain native MVT IDs. A missing/null mapped value removes the original ID. Valid IDs are strings or finite JavaScript safe numbers;invalid values fail the candidate tile before cache publication. Source/rendered queries and sourceLayer-qualified feature state use promoted IDs. Geometry fragments remain separate query results;geometry merging is not claimed.

map.addSource('vector',{type:'vector',tiles:['https://your.example/{z}/{x}/{y}.pbf'],
 promoteId:{places:'name'}});
map.addLayer({id:'places',type:'circle',source:'vector','source-layer':'places',
 paint:{'circle-color':['case',['coalesce',['feature-state','selected'],false],'#ff00ff','#0000ff']}});
map.setFeatureState({source:'vector',sourceLayer:'places',id:'actual name'},{selected:true});
await map.sqs.flush({render:true});

Read fields and IDs from your own data. The configuration survives setTiles/setUrl and map.sqs.getSourceInfo returns promoteId. Shared addSource/addLayer and inline shared Style JSON support promotion. The independent setStyle(URL) basemap path still explicitly rejects it;TileJSON does not override this source option. Syntax references theMapLibre source specification;execution uses SqsMap's shared core. Thecomplete HTMLuses generated tiles/string IDs and contains every button handler.

volatile and persistent caching (07.11)

Shared vector/raster sources accept volatile boolean,default false. True forces tile transport no-store after map cache policy and browser transformRequest options. Desktop jobs skip disk lookup/write and send Cache-Control:no-store. Native JSON requestPlan.cache is no-store;external hosts should execute that plan. Source info reports tileMetadata.volatile and setTiles/setUrl preserve it.

map.addSource('tiles',{type:'vector',tiles:['https://your.example/{z}/{x}/{y}.pbf'],volatile:true});

Bounded decoded/rendering memory remains available. This does not imply per-frame downloads,automatic refresh or a live subscription. Cancellation/retry/fallback follow common resource rules;desktop common tile work now uses Tile-specific policy rules. Shared inline Style JSON/addSource support this option. Independent setStyle(URL) still explicitly rejects volatile:true. The name references theMapLibre source specification;SqsMap defines the browser/native persistent-cache execution behavior. Thecomplete HTMLuses generated tiles and contains all operation code.