Skip to main content

App to Map

In this section you will find messages you can send to the map from your app.

Config

The config Message set any number of configuration paramaters.
Any parameter not set in the message will keep its previous value.
Any parameter which has never been set will use its default settings.

Here is an example of SET_CONFIG message reseting all parameters to their default value.

set-config-example.json
{
"type": "SET_CONFIG",
"message": {
"defaultColor": [255, 255, 255, 1],
"itineraryColorExtremelyCongested": [218, 55, 70, 1],
"itineraryColorHeavylyCongested": [218, 125, 10, 1],
"itineraryColorCongested": [218, 218, 10, 1],
"itineraryColorDefault": [54, 170, 206, 1],
"imageBaseUrl": "src/assets/images",
"iconDefaultSize": 16,
"iconXSRatio": 0.5,
"iconSRatio": 0.75,
"iconLRatio": 1.25,
"iconXLRatio": 1.5,
"siteIcon": "pin_blue_syd.png",
"departureSiteIcon": "bullet_ball_yellow.png",
"operationAffectedIcon": "bullet_square_green.png",
"operationUnaffectedIcon": "bullet_square_red.png",
"activityIcon": "bullet_ball_grey.png",
"activitySelectedIcon": "bullet_ball_grey.png",
"activityCurrentIcon": "bullet_ball_blue.png",
"debugMode": false,
"currentOperationMarkerIcon": "map_pointer.png",
"currentOperationMarkerColor": [128, 128, 0, 1],
"currentActivityMarkerIcon": "map_pointer.png",
"currentActivityMarkerColor": [0, 0, 255, 1],
"additionalMapModes": []
}
}

Render entities

  • Message Type: SET_WEBVIEW_ENTITIES.
  • Payload Type: WebviewState.

Rendering standard Axioroute State

The simplest way to render entities is to send your current Axioroute State like this:

set-webview-entities-example.json
{
"type": "SET_WEBVIEW_ENTITIES",
"payload": {
"sites": [
{
"id": "AXIOROUTE",
"coordinates": {
"longitude": -0.561642,
"latitude": 47.462544
},
"isDepot": false,
"entityType": "SITE"
},
{
"id": "CJM",
"coordinates": {
"longitude": -0.345602,
"latitude": 48.597481
},
"isDepot": false,
"entityType": "SITE"
},
{
"id": "SINARI",
"coordinates": {
"longitude": -1.604869,
"latitude": 48.113197
},
"isDepot": true,
"entityType": "SITE"
}
],

"operations": [],
"pois": [],
"texts": [],
"itineraries": [],
"trucks": [],
"referencePlanning": {
"vehicleRoutes": []
},
"mciRouteLinks": [],
"mciIndependantJobs": []
}
}
Note

You may need to wait that the Map is ready before using this message.
You can see how to do that in Map to App - Ready Status

Rendering custom entities

There are two types of entities to understand within your Axioroute State:

  • data from the Axioroute API (managed by Axioroute SDK)
  • custom data unrelated to Axioroute API (managed by your app)

For the second type of data you can render these entities with Webview Entities. In the state you pass to SET_WEBVIEW_ENTITIES you have 3 parameters to do so:

  • pois: to pass an array of WebviewPOI
  • itineraries: to pass an array of WebviewItinerary
  • texts: to pass an array of WebviewText

Rendering Axioroute logical entities as custom entities

Warning

This is a really advanced topic, don't do that unless you really need it.

For very specific needs, you may also want to render Axioroute Logical entities by using pois, itineraries and texts fields.
It's totally doable but you'll have to transform Axioroute logicial entities on your end.

Still, the SDK expose some methods to make this easier for you:

  • VOperations.getPOI
  • VSites.getPOI
  • VSites.getWebviewText
  • VActivities.getPOIs
  • VItineraries.getItineraries

These methods are the same used within the Map to transform your Axioroute logical entities.

Set entities Selected or Current

  • COMING SOON

Set Map Mode

The SET_MAP_MODE change Map Webview MapMode to the given value.

set-map-mode-example.json
{
"type": "SET_MAP_MODE",
"payload": {
"mode": "CONFIG"
}
}

Show Tooltip

The SHOW_TOOLTIP Message display a tooltip on the map with content and at coordinates provided in payload.

show-tooltip-example.json
{
"type": "SHOW_TOOLTIP",
"payload": {
"content": {
"title": "Demo Title",
"body": "Demo Body with:<br /><strong style='color: red'>HTML Content</strong>"
},
"coords": {
"longitude": 2,
"latitude": 48
}
}
}

Reset GeoJSON

The RESET_GEOJSON Message remove all GeoJSON feature collections from the map.

reset-geojson-example.json
{
"type": "RESET_GEOJSON",
"payload": {}
}