Options
All
  • Public
  • Public/Protected
  • All
Menu

Class D3WindBarb

Hierarchy

  • D3WindBarb

Index

Constructors

Methods

Constructors

constructor

Methods

draw

  • draw(container?: undefined | string): SVGElement
  • Creates wind barb and returns the svg element. If container is provided, the svg will be appended to element if found

    example
    // Use d3-wind-barbs with leaflet to draw wind barbs as markers
    
    const windBarb = new WindBarb(21, 45, {
    size:
    height: 20,
    width: 50
    }).draw();
    
    const leafletIcon = new L.DivIcon({
       html: windBarb.outerHTML
    })
    
    // Now you can use this icon in your L.Marker
    example
    // Use d3-wind-barb with OpenLayers to draw svg icons
    
    const windBarb = new WindBarb(21, 45, {
       size:
         height: 20,
         width: 50
    }).draw();
    
    const style = new ol.style.Style({
      image: new ol.style.Icon({
        opacity: 1,
        src: 'data:image/svg+xml;utf8,' + windBarb.outerHTML
      })
    });
    

    Parameters

    • Optional container: undefined | string

      Id of the element where the svg will be appended if provided

    Returns SVGElement

    SVGElement

Generated using TypeDoc