API Reference

In its simplest form you can create an indoorgraph instance just by passing graph data:

const graph = new Indoorgraphs(data);

You can optionally provide the includeIcons option as well as pathNameIds:

// nodes need to have the attribute "streetid"
const pathNameIds = {
    "1": "Mustermann Straße",
    "2": "Urbig Weg"
}

const graph = new IndoorGraphs(data, { pathNameIds, includeIcons: true });

Methods

// return data
const nodes = graph.getData() 

// set new data
graph.setData(data) 

// get all the attributes that can be used to query paths
const routableOptions = graph.getRoutableOptions({ exclude: ["key1", "key2"] }) 

// calculate shortest path from start to dest
const [coordinates, path, instructions, error] = graph.getRoute(start, dest) 

// return pathAttributes
const pathAttributes = graph.getPathAttributes() 

// Returns the current condition used for removing nodes from the graph
const nodeRemovalCondition = graph.getNodeRemovalCondition() 

// Returns the current condition used for removing edges from the graph.
const edgeRemovalCondition = graph.getEdgeRemovalCondition() 

// Removes nodes from the graph that match the specified condition. Call getRoute() afterwards.
graph.removeNodes(nodeRemovalCondition) 

// Removes edges from the graph that match the specified condition. Call getRoute() afterwards.
graph.removeEdges(edgeRemovalCondition) 

// return nodeAttributes
const nodeAttributes = graph.getNodeAttributes()

// merge graphs
graph.addGraph(dataOutdoor)

Last updated