Making dynamic context changes to road data

You can use the IBM® IoT Connected Vehicle Insights Context Map service in the Route API to make dynamic context changes to road link data. Maps include road, or link, data that can have dynamic attributes, such as speed. You can use the REST API to create, update, and delete dynamic road attributes, and you can retrieve aggregated road attributes that include both static map data and dynamic context data.

DMM configuration

Enable Context Mapping access in the DMM Liberty node with support from the IBM IoT Connected Vehicle Insights operations team.

  1. Context map for time-series configuration The crawler for Weather Company Data traffic flow is unavailable by default. To set up access to traffic flow, you must work with the IBM IoT Connected Vehicle Insights operations team.

  2. Context map for link configuration Use the REST API to set up the Context Map for Link.

Configuring time-to-live (TTL) of cached dynamic data

Context map for time-series configuration

Prediction and forecast data is overwritten by observed data later. As a result, a much shorter TTL is set to predict data than the observed TTL.

  • Weather Company Data traffic flow

  • Default interval of crawling is 15 (minutes)

  • Observed data

    • TTL: 15 (minutes) * 1.1 = 16.5 (minutes)

    • Related parameter: TrafficFlow__TWC.ttl_observation_ratio in ctxmap.properties

  • Prediction data

    • TTL: 15 (minutes) * 0.1 = 1.5 (minutes)

    • Related parameter: TrafficFlow__TWC.ttl_prediction_ratio in ctxmap.properties

  • {{site.data.keyword.weather_company_short}} weather

    • Default interval of crawling is 60 (minutes)

    • Observed data

      TTL: 60 (minutes) * 1.1 = 66 (minutes)

      Related parameter: HourlyWeather__TWC.ttl_observation_ratio in ctxmap.properties

    • Forecast data

      TTL: 60 (minutes) * 0.1 = 6 (minutes)

      Related parameter: HourlyWeather__TWC.ttl_prediction_ratio in ctxmap.properties

Configuring max steps

The crawled data's timestamp is rounded to fix a 1-hour interval, but for Weather Company Data weather crawler, the timestamp is rounded to fit a 15-minute interval. It is possible that crawled weather data might be missing, depending on the invocation timing of data crawler. The following parameters enable the latest crawled data to be queried in DMM:

  • HourlyWeather__TWC.max_steps in ctxmap.properties

  • TrafficFlow__TWC.max_steps in ctxmap.properties

As a result, DMM can get 14:00-15:00 data, for example, even if the 15:00-16:00 interval is not yet crawled, which is shown in the following image of the specification of Weather Company Data weather crawler:

CrawlerSpecAndSteps

Data format

For detailed REST API information, see Context Mapping REST API.

The following image shows the details of links.properties in the GET /mapservice/link response: QueryLinkDataFormat

The following example shows contextmap.link.attributes:

	"contextmap.link.attributes": [
	    {
	        "values": {
	            "value": "68400003417146_value_bbb"
	        },
	        "type": "bbb"
	    },
	    {
	        "values": {
	            "value": "68400003417146_value_aaa"
	        },
	        "type": "aaa"
	    },
	    {
	        "values": {
	            "value": "68400003417146_value_ccc"
	        },
	        "type": "ccc"
	    }
	],

The following example shows HourlyWeather__TWC in contextmap.timeseries.attributes:

    {
        "values": {
            "phrase": "Sunny",
            "snow_1hr": "0.0",
            "temperature": "25",
            "forecast": "true",
            "wind_direction": "236",
            "wind_speed": "10",
            "day_indicator": "D",
            "icon_code": "32",
            "pressure": "1013.35",
            "precip_1hr": "0.0"
        },
        "conditions": {
            "timestamp": "1588035600000"
        },
        "type": "HourlyWeather__TWC"
    },

The following example shows the use of flow_summary of TrafficFlow__TWC in contextmap.timeseries.attributes:

        {
            "values": {
                "measure": "flow_summary",
                "freeFlowSpeed": 94,
                "averageSpeed": 45,
                "currentSpeed": 101,
                "trafficStatus": 3
            },
            "conditions": {
                "direction": 2,
                "timestamp": 1588035600000
            },
            "type": "TrafficFlow__TWC"
        },

The following example shows the prediction of TrafficFlow__TWC in contextmap.timeseries.attributes:

        {
            "values": {
                "measure": "prediction",
                "freeFlowSpeed": 0,
                "averageSpeed": 0,
                "currentSpeed": 75,
                "trafficStatus": 0
            },
            "conditions": {
                "direction": 2,
                "timestamp": 1588035600000
            },
            "type": "TrafficFlow__TWC"
        },

The following example shows the flow_detail of TrafficFlow__TWC in contextmap.timeseries.attributes:

        {
            "values": {
                "measure": "flow_detail",
                "freeFlowSpeed": 94.95106,
                "averageSpeed": 45.06152,
                "currentSpeed": 101.38842
            },
            "conditions": {
                "start_distance": 0,
                "end_distance": 69.569,
                "direction": 2,
                "timestamp": 1588035600000
            },
            "type": "TrafficFlow__TWC"
        },