Creating map cards
A map card is a geospatial map that can show multiple data streams of multiple types with latitudes and longitudes.
About this task
- Card title
- A unique label or heading that is assigned to the card.
- Card tooltip
- A tooltip provides extra details about the data that is displayed on the card.
- End location tooltip
- A tooltip provides extra details about the end location that is displayed on the card.
- Start location tooltip
- A tooltip provides extra details about the start location that is displayed on the card.
- Label
- A unique label that is assigned to a data stream.
You can use the Card builder to create a map card.
Procedure
On the General tab, define the card:
On the Data tab, add data to the card:
On the Style tab, define the style of the card:
Example
tenantId
and shipmentId
variables.query ShipmentDetail($tenantId: String!) {
shipmentDetail: businessObjects(
hint: {viewId: "graph"}
simpleFilter: {tenantId: $tenantId, type: Shipment}
advancedFilter: {AND: [{EQUALS: [{SELECT: "shipmentIdentifier", type: STRING}, {VALUE: "3004555", type: STRING}]}]}
cursorParams: {}
) {
totalCount
edges {
cursor
object {
... on Shipment {
id
shipmentIdentifier
Origin: shipFromLocation {
locationName
locationIdentifier
coordinates
}
Destination: shipToLocation {
locationName
locationIdentifier
coordinates
}
}
}
}
}
}
{
"tenantId": "{{ tenantId }}"
}
The following code is an example of the data that is returned by the query.
{
"data": {
"shipmentDetail": {
"totalCount": 1,
"edges": [
{
"cursor": "NTQ1NTE4Mw==",
"object": {
"id": "64b11459-878e-43bf-b86b-0dea2ec51aac",
"shipmentIdentifier": "3004555",
"Origin": {
"locationName": "LightTree Plant 1 Birmingham",
"locationIdentifier": "LT-1",
"coordinates": "33.5206608, -86.80249"
},
"Destination": {
"locationName": "New York Department of Transportation - New Rochelle",
"locationIdentifier": "NYDOT - New Rochelle",
"coordinates": "40.9114882, -73.7823549"
}
}
}
]
}
},
"loading": false,
"networkStatus": 7
}
The following code is an example of a transform to use for the map card.
{
"errors": "{{#? this.errors}}",
"longitude": "{{this.data.shipmentDetail?.edges[0]?.object?.Origin?.coordinates?.split(',')[1]}}",
"latitude": "{{this.data.shipmentDetail?.edges[0]?.object?.Origin?.coordinates?.split(',')[0]}}",
"totalCount": "{{ this.data.shipmentDetail.totalCount }}",
"results": {
"shipment": {
"{{ #each this.data.shipmentDetail.edges }}": {
"id": "{{ this.object.shipmentIdentifier }}",
"origin": "{{ this.object.Origin.coordinates }}",
"destination": "{{ this.object.Destination.coordinates }}",
"startLocationIdentifier": " {{ this.object.Origin.locationIdentifier }}",
"endLocationIdentifier": " {{ this.object.Destination.locationIdentifier }}"
}
}
}
}
In a transformation, the data that is displayed on map must match the data that is returned by the query. This attribute is selected in the data streams section. A calculation can be made on the data that is returned. In the example, longitude and latitude data are created from shipment object data that the query returns.
What to do next
Add the card to a page by using the Page builder.