Class requestorLocal

This is a requestor for local collections of data. These local collections may originate from inlined code or from datasources other than a MapDotNet REST feature service.

class

requestorLocal

Hierarchy

Index

Constructor methods

Methods

Constructor methods

constructor(options?: { dataFormat?: string; timeoutMs?: number; maxAvailableZoomLevel?: number; data: {}[]; }): requestorLocal

Parameters

  • options?: { dataFormat?: string; timeoutMs?: number; maxAvailableZoomLevel?: number; data: {}[]; } optional

Returns

requestorLocal

Methods

public getCacheEnabled(): boolean

Returns whether or not caching is enabled for vector-based requestors.

Returns

boolean

Whether or not caching is enabled.

public getDataFormat(): string

Gets format of data returned by REST service.

Returns

string

Data format returned by the REST service.

public getFormattedEndpoint(quad: quad, descriptor: any): string

Gets formatted endpoint using the supplied quadtile and a descriptor.

Parameters

  • quad: quad

    Quadtile for which to fetch the endpoint.

  • descriptor: any

Returns

string

The requested URI string.

public getIsRestImage(): boolean

Determines whether or not this requestor returns bitmap images.

Returns

boolean

Whether or not this requestor returns bitmap images.

public getKeyVals(): Array<{}>

??? Gets the additional

Returns

Array<{}>

public getLocalData(quad: quad, descriptor: any): string

Gets data locally if the requestor supports it.

Parameters

  • quad: quad

    Quadtile for which to fetch the endpoint.

  • descriptor: any

Returns

string

The requested JSON data.

public getMaxAvailableZoomLevel(): number

Gets maximum available zoom level content that can be retrieved from the endpoint this requestor consumes.

Returns

number

The maximum available zoom level for this requestor.

public getParsedData(): { Shapes: any[]; Values: any[]; Bounds: 'mapsjs'.envelope[]; }

Returns your source data parsed into theformat { Shapes: [], Values: [], Bounds: [] } This may be useful for doing client-side queries on the local data where all of the WKT has been parsed into points and geometry. There is also a bounds collection to do a quick spatial check for complex polygons.

Returns

{ Shapes: any[]; Values: any[]; Bounds: 'mapsjs'.envelope[]; }

Parsed data object in the form {Shapes, Values, Bounds}.

public getSource(): Array<{}>

Gets the unparsed source data.

Returns

Array<{}>

Array of source data objects.

public getTimeoutMs(): number

Gets requestor timeout in miliseconds.

Returns

number

Requestor timeout in miliseconds.

public getUsesEndpoint(): boolean

Determines whether or not this requestor uses an endpoint rather than local data.

Returns

boolean

Whether or not this requestor gets data from an endpoint.

public hash(descriptor: any): string

Creates unique sha1 hash from this requestor and the supplied descriptor. This is useful in creating a unique key or folder for tile caching. This combined with a tile's quad-key can efficiently and uniquely identify a particular tile.

params

{descriptor} The descriptor for which to create the hash.

Parameters

  • descriptor: any

Returns

string

The generated sha1 hash.

public setCacheEnabled(flag: boolean)

Sets whether or not caching is enabled for vector-beased requestors.

Parameters

  • flag: boolean

public setDataFormat(df: string)

Sets format of data that should be returned by REST service.

Parameters

  • df: string

    Name of the data format the REST service should use.

public setIsRestImage(flag: boolean)

Sets whether this requestor should return bitmap images.

Parameters

  • flag: boolean

    Whether or not this requestor should return bitmap images.

public setKeyVals(options: Array<{}>)

Set any key/value pairs that are attached to the ajax call (such as username and password)

Parameters

  • options: Array<{}>

public setMaxAvailableZoomLevel(max: number)

Sets maximum available zoom level content that can be retrieved from the endpoint this requestor consumes. Note: This defaults to the projection's maximum available zoom level, which is 20 in spherical mercator.

Parameters

  • max: number

    The maximum available zoom level for this requestor.

public setSource(data: Array<{}>)

Sets source data.

Parameters

  • data: Array<{}>

    An array of JavaScript objects to use as the requestor source data.

public setTimeoutMs(ms: number)

Sets requestor timeout in miliseconds.

Parameters

  • ms: number

    Desired requestor timeout in miliseconds.

public setUsesEndpoint(flag: boolean)

Sets whether or not this requestor uses an endpoint rather than local data.

Parameters

  • flag: boolean