Skip to main content

ViewerDataClient

wemap-sdk-js


Class: ViewerDataClient

Fetches the 360° image graph and resolves image URLs from the Wemap VPS endpoint. The endpoint comes from @wemap/core (CoreConfig.getViewerOptions) unless one is passed explicitly (e.g. for tests or staging).

Constructors​

Constructor​

new ViewerDataClient(endpoint?): ViewerDataClient

Parameters​

endpoint?​

string

Returns​

ViewerDataClient

Methods​

getGraph()​

getGraph(): Promise<VisionGraph>

Returns​

Promise<VisionGraph>


getGraphGeojson()​

getGraphGeojson(): Promise<VisionGeojsonGraph>

Returns​

Promise<VisionGeojsonGraph>


getNodes()​

getNodes(): Promise<ViewerNode[]>

Returns​

Promise<ViewerNode[]>


imageUrl()​

imageUrl(filename): string

Parameters​

filename​

string

Returns​

string


locate()​

locate(node, x, y): Promise<Coordinates>

Geo position of what is under pixel (x, y) of a node's image, from the VPS depth estimate. Takes the node's level when the answer has none.

Parameters​

node​

ViewerNode

x​

number

y​

number

Returns​

Promise<Coordinates>


measure()​

measure(node, from, to): Promise<number>

Distance in metres between what is under two pixels of a node's image, from the VPS depth estimate.

Parameters​

node​

ViewerNode

from​

[number, number]

to​

[number, number]

Returns​

Promise<number>