Skip to main content

A matching development SDK with commonLineSymbols also supports shared planar line symbols, including true per-glyph curved geometry, target ownership, joint icon/text groups and shared budgets. Earlier point-only scope and pending line-symbol notes below are superseded for this bounded subset. Complex shaping, tilted/globe/terrain placement and complete road stitching remain pending.

Shared symbol demand events and SDF recoloring

Planar common symbols now emit styleimagemissing for visible points/layers with nonzero size/opacity. Names are deduplicated;events carry id and styleGeneration. Filling then deleting an image,leaving then reentering demand,or replacing the style generation rearms notifications. Style and common-layer demand share one bounded set of at most128 missing names;output/event-budget failure does not acknowledge demand early. Listeners may addImage to complete it. Unsubscribe,stop and destruction release listeners.

import {map} from 'sqsmap';
export const sessionMode='persistent';
const subscription=map.on('styleimagemissing',async event=>{
 if(event.id!=='marker')return;
 map.addImage(event.id,{width:16,height:16,
  data:Array.from({length:256},()=>[0,0,0,255]).flat()},{sdf:true});
 await map.sqs.flush();
});
map.addSource('points',{type:'geojson',data:{type:'Feature',
 properties:{},geometry:{type:'Point',coordinates:[0,0]}}});
map.addLayer({id:'icons',type:'symbol',source:'points',layout:{
 'icon-image':'marker','icon-allow-overlap':true,'icon-ignore-placement':true
},paint:{'icon-color':'#ff0000','icon-opacity':0.8}});
await map.sqs.flush({render:true});
// Release with subscription.unsubscribe();stopping the script also releases it.

SDF images use the alpha distance field,a0.5 boundary and screen-derivative smoothing. icon-color supports common paint expressions,attributes/state/zoom and recolors sdf:true images only. Ordinary RGBA images retain their colors. Color alpha and icon-opacity combine once;zero final alpha produces no query hit. updateImage retains SDF,pixelRatio and identities;distance-image pixel updates refresh rendering. Transparent image areas still query by rectangular footprint,not a per-pixel mask.

Native retained scripts,WASM main-thread/strict Worker and the desktop host share these rules;the mobile host is pending. commonPointIconSDF/commonPointIconMissingImages are true. General text/collision/line placement,globe/pitch and common raster combinations remain pending. The complete HTML includes every image/color/demand handler and11 controls. The portable retained script demonstrates callback completion. Example images/points are generated locally.