Skip to main content

Per-feature line patterns

Select RGBA road patterns within one layer while preserving feature order

When a matching SDK reports commonPlanarLayerComposition:true, the shared Mercator view with zero pitch/roll and no terrain/extrusion combines media, backgrounds, labels, heat and supported static line/fill effects in complete layer order. This capability supersedes earlier media-combination exclusions only within that shared planar scope. Custom line animation, tilted/globe/terrain views and other unsupported material combinations retain their respective limits. Reordering and compatible diff preserve identities, caches, pending requests and fade clocks; material, geometry and texture budgets are validated before publication. See planar layer composition.

Coree684b18d is implemented and pushed; three CPU cases, the same final actual GPU case and the targeted WASM check passed. The same 33 checks and actual pixels pass native/main/Worker; matching development SDK 0.3.0-dev.e684b18d passed all tar-member size/SHA and 23 portable-script checks. Capability commonLinePatternsPerFeature adds per-feature selection alongside uniform patterns. Register decoded images first; road properties can select different images within one layer.

import { map } from 'sqsmap';
// Register your decoded RGBA images with map.addImage('road', imageData).
map.addLayer({
  id: 'roads', type: 'line', source: 'roads',
  layout: { 'line-sort-key': ['get', 'priority'] },
  paint: {
    'line-width': 8,
    'line-pattern': ['coalesce',
      ['image', ['get', 'pattern']], ['image', 'road']]
  }
});
await map.sqs.flush({ render: true });

Selection runs on actual filtered, sorted features and supports property/global values, types, lexical/lazy expressions and typed image/coalesce. Image-selection zoom uses integer steps. A missing image hides only its affected feature; coalesce can select an available fallback, and only attempted missing names generate notices. Original source/ID/properties remain preserved. Transparent stripes retain conservative geometry hits; missing or fully transparent records do not hit.

A/B/A records must draw in that order even when A shares a material. The whole image height maps to actual line width; CSS period remains actual width times image width/height. Image pixelRatio does not change this ratio, and DPR preserves logical dimensions. RGBA is multiplied by opacity; line-color does not tint it. Image/source/state/global/camera candidates must retain old state and display on failure.

Paint feature-state image selection is a SqsMap shared extension queried through capability. The current public MapLibre line-pattern specification lists data-driven selection without declaring that feature-state combination; this extension does not imply complete MapLibre compatibility.

Image width is a power of two in 2..512 and height is 1..512, with stable default butt/miter geometry. Each layer accepts at most 4096 input materials and ordered records; identical W/H/RGBA images deduplicate. Joint static/animation budgets remain 32 layers, 4096 paths, 100000 actual generated vertices, 256 MiB and 10000000 CSS distance per path. Each unique texture rounds upward to 64 KiB pages and adds a 48-byte uniform plus 256-byte binding reserve. A shared 64-byte sampler per layer, 64 bytes per ordered draw record and all vertices also count. Candidate selection retains 100000 displayed records/two million estimated expression nodes; existing depth32/nodes1024/steps8192 limits remain. This scope is frozen; public three-path checks passed; matching development SDK 0.3.0-dev.e684b18d passed all tar-member checks. SDF, explicit topology, nonzero offset/translate/gap/blur, dash/gradient/animation, pitched/globe/media combinations remain unsupported. MVT cross-tile phase and geometry merging remain pending.

The complete portable script and complete HTML have passed the same 33 checks on native/main/Worker with actual blue/green/transparent A/B/A order and partial missing images. Matching development SDK is accepted; local production website evidence is recorded separately. Mobile GIS/iOS/devices, external platforms, complete styles, formal release and deployment remain pending.

Semantics reference the official MapLibre line-pattern specification, implemented independently by SqsMap.