Skip to main content
APIs 4 min read

Optimizing Emergency Response with HERE Reverse Isoline Routing

HERE reverse isoline routing

HERE reverse isoline routing is a powerful feature that allows developers to find assets around a given location within a certain distance or driving time range. From any given location, you can find the closest available resources – such as taxis, hospitals, police stations, fire stations, etc. In this blog post, we will explore how to use the HERE Routing API to generate reverse isolines that can be used in emergency response situations. 

We’ll start with obtaining the API key from HERE platform. Once you have an API key, you can use the API to make requests to the server and receive a response in the form of a polygon shape that represents the area within a certain distance or time range of a given location.

Copied
        let url = `https://isoline.router.hereapi.com/v8/isolines?`+
            `apiKey=YOUR_API_KEY`+
            `&transportMode=car`+
            `&range[type]=time`+
            `&range[values]=300`+ //5 min x 60 seconds
            `&destination=37.7950,29.0825`+
            `&routingMode=fast`;

    fetch(url)
    .then(result => result.json())
    .then(result=>{
        console.log(result);
    })
    .catch(error =>{
        console.log(error);
    })
  

Highlights from the code

  • The Isoline Routing API now supports two new modes - Bus and Taxi transportation modes. So you can choose between the 5 modes – car, pedestrian, truck, taxi, buses. The taxi option is directly useful for all taxi dispatch companies.
  • For reverse isoline calculation, we use the “destination” location instead of “origin”, i.e., the location of emergency.
  • Range can be based on time, distance or even EV consumption.

 

Instead of sending the REST request via fetch separately, you could also use the 'calculateIsoline' method from the routing provider with HERE Maps API for JavaScript. 

Isoline routing takes into account the different vehicle speeds and traffic speed. The response is a flexible polygon that represents encoded value of all points that are 50 km of driving away from the emergency location. It looks like: 

Copied
        {
    "arrival": {
        "time": "2023-01-27T03:59:17+00:00",
        "place": {
            "type": "place",
            "location": {
                "lat": 37.7950755,
                "lng": 29.0823276
            },
            "originalLocation": {
                "lat": 37.7949999,
                "lng": 29.0824999
            }
        }
    },
    "isolines": [
        {
            "range": {
                "type": "time",
                "value": 300
            },
            "polygons": [
                {
                    "outer": "BGo92joC-20t3BuViQ4KmgBA-qB4KmgBuVAuVvVsgCtVuVtVmgB3K4gEAmgB1KwVvVmgB1KmgB2K2KmgBA61C1KmgBrgCwVprDorDrgCwV9qB8qB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VuVrgCsgCrgCAvVl2El2E3KlgB4KlgB-qB9qBmgB1KmgB2KihGkhGwVAuVrgCmgB1K-qBAmgB2KuVsgCuVAwVtVmgB3KmgB4KuVuVuVA-qB7qBuVrgC-qB9qBsgCtVuVvVsgCtV-qB9qBuVrgCmgB1K-qBAmgB2K2KmgBA-qB4KmgBmgB4K-qBAmgB2KuVwVuVAwVrgCuVvVAtVtVtV3KlgBA51C4KlgBmgB3KmgBsFuVmgB"
                }
            ]
        }
    ]
}
  

With HERE Maps API for JavaScript, we can now use H.map.polygon to render this as polygon on the map: 

Copied
        result.isolines.forEach(isoline=>{
     isoline.polygons.forEach(polygon=>{
               let linestring = H.geo.LineString.fromFlexiblePolyline(polygon.outer);
               let count= result.isolines.indexOf(isoline);

               // Create a polyline to display the route:
               let routePolygon = new H.map.Polygon(linestring,{
                  style: {
                     fillColor: 'rgba(74, 134, 255, 0.3)',
                     strokeColor: '#4A86FF',
                     lineWidth: 2
                  }
               });
               
            let isolineGroups = new H.map.Group();
            isolineGroups.addObject(routePolygon);
            map.addObject(isolineGroups);
        
            // Set the map's viewport to make the whole route visible:
             map.getViewModel().setLookAtData({bounds: isolineGroups.getBoundingBox()});
   });
});
  
isoline

We can now use this shape to query point of interest database, such as the HERE Places API, to find all hospitals within this area. From the list of hospitals, we can select the closest one or multiple closest one based on the emergency situation and send the emergency response team to that location. This allows them to transport the patient to the hospital that is most likely to provide the best medical care in the shortest amount of time. This is also applicable to finding the closest fire station or police station.

Optimizing routes for multiple emergency calls

When there are multiple emergency calls to be handled in a specific area, the emergency response system can use reverse isoline routing to find the optimal routes for the emergency responders. This allows them to handle multiple emergencies at the same time and reduce response time.

Improving resource utilization

Reverse isoline routing can also be used to improve the utilization of emergency response resources such as ambulances, fire trucks, and police cars by providing them with the information of the best applicable resources to the emergency locations.

Conclusion

Overall, reverse isoline routing can be used to optimize emergency response times and help that those emergency responders are selected that can arrive at the emergency location as quickly as possible. This can potentially save lives and property. Learn more about isolines and reverse isolines.

Mohini Todkari

Mohini Todkari

Sr. Developer Evangelist

Have your say

Sign up for our newsletter

Why sign up:

  • Latest offers and discounts
  • Tailored content delivered weekly
  • Exclusive events
  • One click to unsubscribe