Find closest facility to an incident (interactive)
Find a route to the closest facility from a location.
Quickly and accurately determining the most efficient route between a location and a facility is a frequently encountered task. For example, a paramedic may need to know which hospital in the vicinity offers the possibility of getting an ambulance patient critical medical care in the shortest amount of time. Solving for the closest hospital to the ambulance's location using an impedance of "travel time" would provide this information.
Tap near any of the hospitals and a route will be displayed from that clicked location to the nearest hospital.
- Create a
ClosestFacilityTaskusing a Url from an online network analysis service.
- Add facilities to parameters,
- Add the incident to parameters,
ClosestFacilityResultfrom solving task with parameters,
- Get index list of closet facilities to incident,
- Get index of closest facility,
- Find closest facility route,
Display route to
Graphicfrom route geometry,
- Add graphic to
GraphicsOverlaywhich is attached to the mapview
incident, network analysis, route, search
<?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms" xmlns:mapping="clr-namespace:Esri.ArcGISRuntime.Mapping;assembly=Esri.ArcGISRuntime" x:Class="ArcGISRuntime.Samples.ClosestFacility.ClosestFacility"> <Grid> <esriUI:MapView x:Name="MyMapView" /> </Grid> </ContentPage>