Interface: MapVXSDK
Methods
cleanRoutesCache()
void
Delete cache for normal and accessible routes if exist
Returns
void
createMap()
HTMLElement
Creates a map within a specified HTML element container using the provided map configuration.
Parameters
container
HTMLElement
The html element where the map will be in your page.
mapConfig
The configuration for the map.
Returns
The created MapVXMap object.
Throws
Will throw an error if the map creation fails.
getAnyPlaceDetail()
MapConfig
Get the information from a place. Might be a place that is not necessarily allowed by the ApiKey.
Parameters
id
string
The id of the place.
authToken
string
The auth token of the user.
Returns
Promise<MVXPlace>
Throws
Will throw an error if fail to get the detail of the place.
getAnySubPlaces()
MapVXMap
Get the sub-places from a parent place. Might include sub-places not necessarily allowed by the ApiKey.
Parameters
parentPlaceId
string
The id of the parent place.
authToken
string
The auth token of the user.
Returns
Promise<MVXPlace[]>
A promise with the list of sub-places.
Throws
Will throw an error if fail to get the sub-places.
getAvailablePlaces()
string
Get the places associated to the token added on the class constructor.
This method also returns all places associated with the allowed institutions.
Also this return child_places as a list of string.
Returns
Promise<MVXPlace[]>
A list of the places associated to the token.
Throws
Will throw an error if fail to get the parent places.
getCachedPlaces()
string
Get the cached information of the places.
If a id is not cached, it will be ignored.
Parameters
ids
string[]
The identification of the places
Returns
MVXPlace[]
getCacheTimestamp()
Promise
Returns the timestamp of the last cache update for the specified parent place.
Parameters
parentPlaceId
string
Id of parent place whose cache timestamp is requested
Returns
Promise<number>
getCategories()
MVXPlace
Obtain categories of a place
Parameters
placeId?
string
parent place identifier
Returns
Promise<Category[]>
getConfiguration()
string
Obtain initial configuration of a parent place map
Parameters
placeId?
string
parent place identifier
product?
MapVxProduct
product type caller of the configuration, currently supports “directory”, “totems”, and “demo”
Returns
Promise<Configuration>
getCssCustomization()
string
Get the CSS customization associated with the api key for the different products. For now is available only for the type ‘totems’.
Parameters
type
string
The type of product for which customization is required (ex. ‘totems’).
Returns
Promise<CssCustomization>
A json with the css customization.
getInstitutions()
Promise
Get information from all institutions of the apiKey.
The type of the property child_places of the returned values is a list of string.
Returns
Promise<Institution[]>
The information from all institutions of the apiKey.
getPlaceDetail()
MVXPlace
Get the information from a place.
Parameters
id
string
The id of the place.
Returns
Promise<MVXPlace>
Throws
Will throw an error if fail to get the detail of the place.
getPlacesByCategory()
child_places
Get a list of places from a determined category.
Parameters
category
string
The category for which you want to obtain its places.
Returns
Promise<MVXPlace[]>
A list with the places from that category.
Deprecated
Not yet implemented.
getPlacesByInput()
Promise
Get a list of places that match a input. The orden on the list is from high to low match.
Note: The parameters parentPlaceId and otherParentPlacesIds will be unified on the next major
version.
Parameters
input
string
The user input
institutionId
string
The identifier of the institution to search within
parentPlaceId?
string
(Optional) A parent place identifier to filter the results.
otherParentPlacesIds?
string[]
(Optional) An array of parent place ids to filter the results.
origin?
string
(Optional) The ID of a totem or a place origin from directories. Used to return search results based on distance from the origin.
lat?
string
(Optional) Latitude as a string for location-based search.
lng?
string
(Optional) Longitude as a string for location-based search.
floor?
string
(Optional) Floor ID as a string for location-based search.
Returns
Promise<MVXPlace[]>
A list with the places that match the input.
getPlacesFromInstitution()
MVXPlace
Get the list of places from a specific institution. Might include places not necessarily allowed by the ApiKey.
Parameters
institutionId
string
The id of the institution.
authToken
string
The auth token of the user.
Returns
Promise<MVXPlace[]>
A promise with the list of places from the institution.
Throws
Will throw an error if fail to get the places from the institution.
getRoute()
string
Get a route.
Parameters
routeConfig
The configuration to describe the requested route.
Returns
Promise<MVXRoute>
The information of the route.
getRouteV2()
MVXPlace
Get a route. Use a new endpoint for the route data.
Parameters
routeConfig
The configuration to describe the requested route.
Returns
Promise<MVXRoute>
The information of the route.
getSubPlaces()
string
Get the sub-places from a parent place.
Parameters
parentPlaceId
string
The place identifier from which will be obtained is sub-places.
Returns
Promise<MVXPlace[]>
A promise with a list of sub-places.
getTransport()
Promise
Obtains the data of a particular transport according to the identifier
Parameters
stopId
string
Returns
Promise<MVXTransport>
A object MVXTransport with the information of the stop
Throws
Will throw an error if fail to get the transport information
getUserLocation()
number
Get location of current user with latitude and longitude info
Returns
Promise<GeolocationPosition>
Single location object with LatLng of current user
loadRoutesForOriginCache()
string
Retrieves information of routes from an specific place to every other subplace of it’s own parent place. Then populates a cache which will be consulted -and accessed if possible- each time a route is requested from the selected origin place.
Parameters
parentPlaceId
string
Parent place of origin and destination places.
fromPlaceId
string
Origin place of requested routes.
announceFormat
The desired format for the route instructions announcement.
unitSystem
The unit system used for the route distance measurements.
mode
The transportation mode to be used in the routes.
Returns
void
notifyHealth()
Promise
Notify to the server the current status of the totem,
Parameters
healthPingId
string
The id for the health ping.
placeId
string
The id of the place.
totemId
string
The id of the totem
status
boolean
The status of the totem.
Returns
Promise<HealthResponse>
setGeoLocation()
Category
Set the geolocation object to use for tracking the user’s location.
Parameters
geoLocation
Geolocation
the geolocation object to use for tracking the user’s location.
Returns
void
Default
string
setSdkLang()
MapVxProduct
Set the language of the SDK.
Parameters
lang
string
The language to set.
Returns
void
unwatchUserHeading()
Promise
Unregister user heading monitoring
Returns
void
unWatchUserPosition()
Configuration
Unregister user location monitoring
Parameters
watchId
number
A watchId given by the watchUserPosition method
Returns
void
watchUserHeading()
string
Watches the user’s heading and calls the provided callback with the heading value. Note: This method requires HTTPS to work properly.
Parameters
onSuccess
(heading) => void
The callback function to call with the user’s heading.
onError
(error) => void
The callback function to call if an error occurs.
Returns
void
watchUserPosition()
Promise
Watches the user’s position and calls the provided callback with a custom LatLng object.
Parameters
onSuccess
The callback function to call with the user’s position.
onError
PositionErrorCallback
Returns
number
A watchId for the position watcher.