Options
All
  • Public
  • Public/Protected
  • All
Menu

Module ml

Public MapLarge namespace containing all classes, objects and elements.

Jump to the documentation for creating a MapLarge Map using ml.map or Layer using ml.layer methods.

Index

Type aliases

MixinsConstructor

MixinsConstructor: object

Type declaration

Variables

apimanager

apimanager: ApiManager

Singleton of ml.servers.ApiManager

bingMapsApiKey

bingMapsApiKey: string

Bing Maps Client ID will be used if it contains a value.

cesiumIonApiKey

cesiumIonApiKey: string

cesiumIon Client ID will be used if it contains a value.

googleMapsApiKey

googleMapsApiKey: string

Google Maps API key.

googleMapsChannel

googleMapsChannel: string

Google Maps channel will be used if it contains a value.

googleMapsClientID

googleMapsClientID: string

Google Maps Client ID will be used if it contains a value.

loadLayer

loadLayer: layer

Alias for ml.layer function.

nossl

nossl: boolean

Set to true of site does not have SSL registered

pageLoaded

pageLoaded: boolean

Set to true when ml has succesfully loaded on the page

promise

promise: promise

Allows asynchronous methods return values like synchronous methods: instead of immediately returning the final value, the asynchronous method returns a promise to supply the value at some point in the future.

  • Example:

    // verify and authenticate using a token
    var promise = ml.promise<any>(function(resolve, reject) {
         // do our async work
         if (response.error)
             reject(response);
         else
             resolve(response);
    });
    

    @param callback An async function that is executed and the response can be resolved or rejected. @returns Returns a promise

version

version: string

JavaScript API version.

wellknown

wellknown: WellKnown

An alias for ml.WellKnown

Functions

BarChart

  • BarChart(div: string | HTMLDivElement, data: any, opts: any): any
  • Generate a Bar Chart

    Example:

    ml.PieChart(ml.$("#placeholder"), data, ops);
    

    Parameters

    • div: string | HTMLDivElement
    • data: any
    • opts: any

    Returns any

    a new BarChart object

LatLng

  • LatLng(lat: number, lng: number): LatLng
  • Generate a LatLng object

    Example:

    ml.LatLng(48.6074416, -122.8958015); // => {lat: 48.6074416, lng: -122.8958015}
    

    Parameters

    • lat: number
    • lng: number

    Returns LatLng

MapSync

  • Parameters

    • maps: Map[]

    Returns MapSync

PieChart

  • PieChart(div: string | HTMLDivElement, data: any, opts: any): any
  • Generates a Pie Chart Example:

    ml.PieChart(ml.$("#placeholder"), data, ops);
    

    Parameters

    • div: string | HTMLDivElement
    • data: any
    • opts: any

    Returns any

ajax

  • ajax(url: string, callback: function, encode?: boolean, timeout?: number, onFailCallback?: function): void
  • Generate an Ajax request

    Example:

    ml.ajax("./", (args) => console.log('success!', JSON.stringify(args)), true, 100, (err) => console.err(e));
    

    Parameters

    • url: string
    • callback: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional encode: boolean
    • Optional timeout: number
    • Optional onFailCallback: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns void

all

  • all<T>(obj: T, predicate: function): boolean
  • Check if callback condition is met by ALL elements in array/object

    Example:*

    ml.all([1, 2, 3, 4, 5], (i,e) => e < 6); // => true
    ml.all([1, 2, 3, 4, 5], (i,e) => e < 2); // => false
    
    ml.all({a: 1, b: 2, c: 3, d: 4}, (i, e) => e < 7); // => true
    ml.all({a: 1, b: 2, c: 3, d: 4}, (i, e) => e < 2); // => false
    
    

    Type parameters

    • T

    Parameters

    • obj: T
    • predicate: function
        • (key: any, value: any): boolean
        • Parameters

          • key: any
          • value: any

          Returns boolean

    Returns boolean

    boolean

any

  • any<T>(obj: T, predicate: function): boolean
  • Check if callback condition is met by at least one element in array/object Example: `javascript ml.any([1, 2, 3, 4, 5], (i,e) => e < 6); // true ml.any([1, 2, 3, 4, 5], (i,e) => e < -1); // => false

    ml.any({a: 1, b: 2, c: 3, d: 4}, (i, e) => e < 2); // => true
    ml.any({a: 1, b: 2, c: 3, d: 4}, (i, e) => e < -2);  // => false
    

    `

    Type parameters

    • T

    Parameters

    • obj: T
    • predicate: function
        • (key: any, value: any): boolean
        • Parameters

          • key: any
          • value: any

          Returns boolean

    Returns boolean

    boolean

chart

  • chart(div: string | HTMLDivElement, data: any, opts: any): any
  • Example:

    ml.PieChart(ml.$("#placeholder"), data, ops);
    

    Parameters

    • div: string | HTMLDivElement
    • data: any
    • opts: any

    Returns any

create

  • create(tag: string, cssText?: string, appendTo?: HTMLElement, innerHTML?: string): HTMLElement
  • Create a DOM element using optional style attributes, optionally append it to another DOM element and optionally provide HTML content.

    Example:

    var html = "<p>Mapping platform for big data visualization, analytics and publishing.</p>";
    var div = ml.create('div', 'width:100%;height:100%', document.body, html);
    

    Parameters

    • tag: string

      Type of DOM element to create.

    • Optional cssText: string

      Optional content for the style attribute.

    • Optional appendTo: HTMLElement
    • Optional innerHTML: string

      Optional HTML content.

    Returns HTMLElement

    A reference to the new DOM element.

dashboard

  • dashboard(element: HTMLElement | string, definition: IControlDefinition<any><any>, options?: IDashboardCreateOptions): BaseControl<any><any>
  • Creates a new dasbhoard control, and potentially a new dashboard. If a scope and parent control option properties are provided, the control will be added to that dashboard. If they are not provided then a new dashboard will be created with this control as the top-level control.

    Parameters

    • element: HTMLElement | string

      HTML element to place control into.

    • definition: IControlDefinition<any><any>

      Definition of the control to create.

    • Optional options: IDashboardCreateOptions

      Options to pass to <<ml.ui.dashboard.create>> method, such as Scope or Parent.

    Returns BaseControl<any><any>

    Returns the new control.

each

  • each<T>(obj: T, callback: function): void
  • Loop over the elements of an array or fields in an object

    Example:

    var a = [];
    ml.each([1, 2, 3, 4, 5], (i,e) => a.push(e + 2));
    // => a == [3, 4, 5, 6, 7]
    

    Type parameters

    • T

    Parameters

    • obj: T
    • callback: function
        • (key: any, value: any): any
        • Parameters

          • key: any
          • value: any

          Returns any

    Returns void

    void

filter

  • filter<T>(obj: T, predicate: function): any[]
  • Create sub-array/object to fields/elements that match requirements in callback

    Example:

    ml.filter([1, 2, 3, 4, 5], (i,e) => e < 3);             // => [1, 2]
    ml.filter({a: 1, b: 2, c: 3, d: 4}, (i, e) => e < 3)  // => [1, 2]
    

    Type parameters

    • T

    Parameters

    • obj: T
    • predicate: function
        • (key: any, value: any): boolean
        • Parameters

          • key: any
          • value: any

          Returns boolean

    Returns any[]

    any[]

html

  • html(templateOrClassName: string, replace?: object, ejsdata?: string): string
  • Get the html representation of a component from it's namespace path Example:

    ml.html('ui.map.editor.LayerListItem');
    

    Parameters

    • templateOrClassName: string
    • Optional replace: object
      • [key: string]: any
    • Optional ejsdata: string

    Returns string

id

  • id(): string
  • Get a unique ID.

    Returns string

    string

indom

  • indom(element: any): boolean
  • Check if an element is attached to the dom

    ml.indom("#ElementID"); // => "true"
    

    Parameters

    • element: any

    Returns boolean

    boolean

layer

  • Create an instance of a MapLarge ml.ui.map.Layer class on the map provided.

    Example:

    var map = ml.map('mapDiv');
    
    var layerOptions = {
        "query": {
            "select": {
                "type": "geo.dot"
            }
        },
        "visible": true,
        "onClick": "debug"
    };
    var layer = ml.layer(map, layerOptions);
    

    Parameters

    • map: Map

      A reference to the <<ml.ui.map.Map>> instance which will show the layer.

    • Optional layerOptions: IMlUiLayerOptionsInterface

      Layer options object

    • Default value onLoad: function = null

      Callback function for Leaflet. Executed after Leaflet has initialized the map layer.

        • (response?: object): void
        • Parameters

          • Optional response: object

          Returns void

    • Default value triggerCallback: string = null

    Returns Layer

    A reference to an instance of the ml.ui.map.Layer class.

ll

  • ll(lat: number, lng: number): LatLng
  • Create new ml lat lng object. Use ml.LatLng

    deprecated

    Parameters

    • lat: number
    • lng: number

    Returns LatLng

load

  • load(div: HTMLDivElement, options: any, id: string, callback: Function): any
  • Load a dashboard by id

    Example:

    ml.load(ml.$('body'), {}, dashboardId, () => {});
    

    Parameters

    • div: HTMLDivElement

      Existing DOM element.

    • options: any

      HTML Div Element options

    • id: string

      ID of dashboard

    • callback: Function

      function after load is complete

    Returns any

map

  • map(googleMap: Map, mapOptions?: MapOptions): any
  • map(parentElement?: HTMLElement, mapOptions?: MapOptions, existingMap?: any): any
  • map(parentElementId?: string, mapOptions?: MapOptions, existingMap?: any): any
  • Create an instance of a MapLarge ml.ui.map.Map and attach to the Google map reference provided.

    Example:

    var mapOptions = {
        center: { lat: -34.397, lng: 150.644},
        zoom: 8
    };
    var googleMap = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
    var map = ml.map(googleMap);
    

    Parameters

    • googleMap: Map

      Reference to an existing Google map instance.

    • Optional mapOptions: MapOptions

      MapLarge map options object.

    Returns any

    A reference to an instance of the MapLarge <<ml.ui.map.Map>> class which uses the Google map provided.

  • Create an instance of a MapLarge ml.ui.map.Map in the DOM element provided.

    Example:

    var mapOptions = {
        "lat": 38.03078569382294,
        "lng": -95.33935546875,
        "z": 5,
        "searchBox": true,
        "api": "LEAFLET",
        "layers": [],
        "drawingToolsHidden": true,
        "drawingEditingEnabled": true
    };
    var map = ml.map(document.getElementById('mapDiv'), mapOptions);
    

    Parameters

    • Optional parentElement: HTMLElement

      Existing DOM element.

    • Optional mapOptions: MapOptions

      MapLarge map options object.

    • Optional existingMap: any

    Returns any

    A reference to an instance of the MapLarge <<ml.ui.map.Map>> class.

  • Create an instance of a MapLarge ml.ui.map.Map in the DOM element referenced by the element ID value.

    Example:

    var mapOptions = {
        "lat": 38.03078569382294,
        "lng": -95.33935546875,
        "z": 5,
        "searchBox": true,
        "api": "LEAFLET",
        "layers": [],
        "drawingToolsHidden": true,
        "drawingEditingEnabled": true
    };
    var map = ml.map('mapDiv', mapOptions);
    

    Parameters

    • Optional parentElementId: string

      Existing DOM element.

    • Optional mapOptions: MapOptions

      MapLarge map options object.

    • Optional existingMap: any

    Returns any

    A reference to an instance of the MapLarge <<ml.ui.map.Map>> class.

merge

  • merge(base: any, override: any): any
  • Combine two objects Example:

    ml.merge({a: 1, b:2}, {c: 3, d: 4}); //=>  {c: 3, d: 4, a: 1, b: 2}
    

    Parameters

    • base: any
    • override: any

    Returns any

    any

metadata

  • metadata(): Metadata
  • Get the metadata

    Returns Metadata

mock

  • mock(f: any): any
  • Create a cloned instance of f

    Parameters

    • f: any

      A constructor

    Returns any

    new instance of f

nvp

  • nvp(url?: string): any
  • Get the current URL query string arguemnts

    Example:

    //url = "http://maplarge.net/map.html?h=1&j=5";
    
    var params = ml.nvp();
    
    //params => {h: "1", j: "5"}
    

    Parameters

    • Optional url: string

    Returns any

    string

onload

  • onload(callback: function): void
  • Run when the ml namespace has successfully loaded Example:

    ml.onload(() => {
        console.log(ml.version);
    });
    

    Parameters

    • callback: function

      Called when the ml namepsace has finished loading.

        • (): void
        • Returns void

    Returns void

    void

query

  • Create a new ml Query object

    Example:

    var q = ml.query();
    

    Returns Query

replace

  • replace(subject: string, find: string, replaceWith: string): string
  • Create a new string where the 'find' string has been replaced with 'replaceWith' inside of the subject string.

    Example:

    ml.replace('the quick brown fox jumped over the lazy dog', 'quick', 'fast');
    // => "the fast brown fox jumped over the lazy dog"
    

    Parameters

    • subject: string
    • find: string
    • replaceWith: string

    Returns string

round

  • round(num: number, dec: number, fixed?: number): string
  • Round a given number to the provided decimal place.

    Example:

    ml.round(14.502, 3, 5)// => "14.50200"
    ml.round(14.502, 1)     // => "14.5"
    ml.round(14.509, 3, 2)// => "14.51"
    

    Parameters

    • num: number
    • dec: number
    • Optional fixed: number

    Returns string

select

  • select<T>(obj: T, selector: function, includeNull?: boolean): any[]
  • Create new array from parts of obj

    Example:

    ml.select([1, 2, 3, 4, 5], (i,e) => e + 2);             // => [3, 4, 5, 6, 7]
    ml.select({a: 1, b: 2, c: 3, d: 4}, (i, e) => e + 2); // => [3, 4, 5, 6]
    

    Type parameters

    • T

    Parameters

    • obj: T
    • selector: function
        • (key: any, value: any): any
        • Parameters

          • key: any
          • value: any

          Returns any

    • Default value includeNull: boolean = true

    Returns any[]

    any[]

shortURL

  • shortURL(path?: string, query?: QueryParamObject | string, auth?: boolean, customPrefix?: string): string
  • Generates a relative URL (based off the currentt domain).

    Example:

    ml.shortURL("/v4/ui/example/codemirror/addon/display/fullscreen.css");
    

    Parameters

    • Optional path: string
    • Optional query: QueryParamObject | string
    • Default value auth: boolean = true
    • Default value customPrefix: string = null

    Returns string

trim

  • trim(s: any): string
  • Remove leading and trailing whitespace if s is not null or undefined. Example:

    ml.trim("     hello    "); // => "hello"
    

    Parameters

    • s: any

    Returns string

    string

url

  • url(path?: string, query?: any, servers?: MlServers[], customPrefix?: string, noauth?: boolean): string
  • Generates a URL string for a full domain based on the given inputs

    Example:

    var url = ml.url('/geocoder/ReverseGeocode?latitude=' + ll.lat + '&longitude=' + ll.lng);
    

    Parameters

    • Optional path: string
    • Optional query: any
    • Optional servers: MlServers[]
    • Optional customPrefix: string
    • Default value noauth: boolean = false

    Returns string

    string

verifyToken

  • verifyToken(user: string, token: string, callback?: function): void
  • Verify and authenticate using a token. Upon success, it will automatically enable the MapLarge UI for the authenticated user. Upon failure, it will automatically notify the MapLarge UI that the user is unauthenticated.

    Example:

    // verify and authenticate using a token
    ml.verifyToken('maplarge', '1845447458_1440097778', function(response) {
        if (response.success) {
            // authentication was successful
        else {
            // authentication failed
        }
    });
    

    Parameters

    • user: string

      An existing user login.

    • token: string

      An authentication token.

    • Optional callback: function

    Returns void

Object literals

authSettings

authSettings: object

acceptJwtTokens

acceptJwtTokens: boolean

alwaysCallLogin

alwaysCallLogin: boolean

canLogIn

canLogIn: boolean

canLogOut

canLogOut: boolean

clientShouldSetCookie

clientShouldSetCookie: boolean

secureAuthCookie

secureAuthCookie: boolean

showSplashScreenOnFailure

showSplashScreenOnFailure: boolean

ssoLogoutURL

ssoLogoutURL: null