maplibre-gl-svg-sprite - v0.1.0
    Preparing search index...

    Function buildSvgUrl

    • Build a type-safe SVG protocol URL

      Parameters

      • params: SvgUrlParams

        URL parameters with full TypeScript support

      Returns string

      SVG protocol URL string

      // Simple marker with colors
      buildSvgUrl({
      icon: 'marker',
      width: 44,
      height: 44,
      pixelRatio: 2,
      bg: '#ffffff',
      fg: '#d35400'
      });
      // => 'svg://marker?width=44&height=44&pixelRatio=2&bg=%23ffffff&fg=%23d35400'

      // Marker with text overlay
      buildSvgUrl({
      icon: 'marker',
      width: 44,
      height: 44,
      pixelRatio: 2,
      bg: '#ffffff',
      fg: '#d35400',
      text: 'EWR',
      fontSize: 18,
      textColor: '#d35400'
      });

      // With SVG overlay
      buildSvgUrl({
      icon: 'marker',
      width: 64,
      height: 64,
      overlay: 'star',
      ow: 24,
      oh: 24,
      anchor: 'top-right'
      });

      // Grid of icons
      buildSvgUrl({
      icon: 'base',
      width: 100,
      height: 100,
      icons: 'icon1,icon2,icon3,icon4',
      columns: 2,
      gap: 4
      });