Options
All
  • Public
  • Public/Protected
  • All
Menu

Module Attribution

Index

Functions

addMultiple

  • JMap.Map.Attribution.addMultiple

    Add multiple attributions on the map.

    throws

    Errors if invalid parameters, or if an attribution having the same id already exists

    example
    
    // Add two custom attributions on the map.
    JMap.Map.Attribution.addMultiple([{ id: "custom-attribution-0",
     text: "© K2Geospatial",
     href: "https://k2geospatial.com/jmap-en/" },
    { id: "custom-attribution-1",
     text: "© StackOverflow",
     href: "https://stackoverflow.com/" }])

    Parameters

    Returns void

addSingle

  • JMap.Map.Attribution.addSingle

    Add a custom attribution on the map.

    throws

    Errors if some parameters are invalid, or if an attribution having the same id already exists

    example
    
    // Add a link attribution on the map.
    JMap.Map.Attribution.addSingle({ id: "link-test", text: "© HelloWorld", href:"https://k2geospatial.com/jmap-en/"})
    
    // Add a text attribution on the map
    JMap.Map.Attribution.addSingle({ id: "text-test", text: "© HelloWorld"})
    
    // Add a image attribution on the map.
    JMap.Map.Attribution.addSingle({id: "test-image",
    imageUrl: "https://k2geospatial.com/wp-content/themes/k2-theme/assets/images/k2-logo.png",
    href: "https://k2geospatial.com/jmap-en/"})

    Parameters

    Returns void

getAll

  • JMap.Map.Attribution.getAll

    Returns all attributions displayed on the map.

    example
    
    // Get all attributions currently displayed.
    const attributions = JMap.Map.Attribution.getAll()
    

    Returns JMapAttribution[]

getById

  • JMap.Map.Attribution.getById

    Returns an attribution for the given id

    example
    
    // Display a mapbox attribution.
    console.log(JMap.Map.Attribution.getById("mapbox-satellite-1-attribution"))
    

    Parameters

    • attributionId: string

      The attribution id

    Returns JMapAttribution

isDefaultAttributionId

  • isDefaultAttributionId(attributionId: string): boolean
  • JMap.Map.Attribution.isDefaultAttributionId

    Returns true if the given id is reserved

    example
    
    // Display if "custom-attribution" is a reserved id
    console.log(JMap.Map.Attribution.isDefaultAttributionId("custom-attribution"))
    

    Parameters

    • attributionId: string

      The attribution id

    Returns boolean

removeByIds

  • removeByIds(attributionsIds: string[]): void
  • JMap.Map.Attribution.removeByIds

    Remove the attributions from the map for the given ids (does nothing if id not found)

    throws

    Error if attributionsIds is not an array

    example
    
    // Remove a custom attribution from the map.
    JMap.Map.Attribution.removeByIds(["my-attribution"])
    

    Parameters

    • attributionsIds: string[]

      array of attribution ids to remove

    Returns void