Options
All
  • Public
  • Public/Protected
  • All
Menu

Helper Class for the URL handling.

Hierarchy

  • UrlUtil

Index

Constructors

constructor

Methods

Static bundleOgcRequests

  • bundleOgcRequests(featureInfoUrls: string[], stringify?: boolean, bundleParams?: string[]): {}

Static createValidGetCapabilitiesRequest

  • createValidGetCapabilitiesRequest(url: string, service?: Service, version?: string): string
  • Creates a valid GetCapabilitiesRequest out of the given URL by checking if SERVICE, REQUEST and VERSION are set.

    Parameters

    • url: string

      The URL to validate.

    • service: Service = 'WMS'

      The service to set. Default is to 'WMS'.

    • version: string = '1.3.0'

      The version to set. Default is to '1.3.0'.

    Returns string

    The validated URL.

Static getBasePath

  • getBasePath(url: string): string
  • Returns the base path of an URL.

    Parameters

    • url: string

      The URL to obtain the base path from.

    Returns string

    The base path.

Static getQueryParam

  • getQueryParam(url: string, key: string): string
  • Returns the value of the given query param of the provided URL. If not found, undefined will be returned.

    Parameters

    • url: string

      The URL to get the query params from.

    • key: string

      The key to get the value from.

    Returns string

    The query param value.

Static getQueryParams

  • getQueryParams(url: string): {}
  • Returns the query params of a given URL as object.

    Parameters

    • url: string

      The URL to get the query params from.

    Returns {}

    The query params of the given URL.

    • [key: string]: string | undefined

Static hasQueryParam

  • hasQueryParam(url: string, key: string): boolean
  • Checks if a given URL has the provided query parameter present.

    Parameters

    • url: string

      The URL to check.

    • key: string

      The query parameter to check.

    Returns boolean

    Whether the parameter is present or not.

Static isValid

  • isValid(url: string, opts?: IsURLOptions): boolean

Static joinQueryParams

  • joinQueryParams(params1: any, params2: any, keys: string[]): any
  • Joins some query parameters (defined by keys) of two query objects and returns the joined query parameters.

    var params1 = {FOO: 'foo,bar', BAZ: 'baz', HUMPTY: '1'};
    var params2 = {FOO: 'pupe,pape', BAZ: 'baz', DUMPTY: '42'};
    var keys = ['FOO'];
    var joined = this.joinQueryParams(params1, params2, keys);
    // joined is now
    // {FOO: 'foo,bar,pupe,pape', BAZ: 'baz', HUMPTY: '1'};
    

    Parameters

    • params1: any

      The first object with parameters, where certain keys might have values that are joined with ,.

    • params2: any

      The second object with parameters, where certain keys might have values that are joined with ,.

    • keys: string[]

      The keys which we will consider for joining. Others will be taken from the first object with parameters.

    Returns any

    The joined query parameters.

Static objectToRequestString

  • objectToRequestString(object: any): string
  • Transforms an object into a string containing requestParams (without leading questionmark).

    Parameters

    • object: any

      An object containing kvp for the request. e.g. {height:400, width:200}

    Returns string

    The kvps as a requestString. e.g. 'height=400&width=200'

Static read

  • read(url: string): URLParse
  • Returns an object representation of an URL.

    Parameters

    • url: string

      The URL to read in.

    Returns URLParse

    The parsed URL object.

Static write

  • write(urlObj: URLParse): string
  • Returns a string representation of an URL object.

    Parameters

    • urlObj: URLParse

      The URL object to write out.

    Returns string

    The stringified URL.

Generated using TypeDoc