Sorry, you need to enable JavaScript to visit this website.

Reachable range

Reachable range

The Reachable Range component calculates a set of locations that can be reached from the origin point. It optimizes routes with a given route-type (e.g., fastest, eco, etc.) but limits the range for the given budget and consumption parameters. It uses the Calculate Reachable Range API so you can find all details in the service documentation.

Sample use case: You are preparing for a trip and you would like to check how far you can drive on your battery or tank, or within a specific time limit so you can plan your journey.

The following example shows a number of points that are reachable based on one of a specified model for: * Combustion engine * Electric engine * Time-2h limit on an electric car (time budget model is available for both electric and combustion engines)

Use the following code sample to implement a similar use case.

To request a reachable range, create a ReachableRangeQuery:

_

return ReachableRangeQueryBuilder.create(Locations.AMSTERDAM_CENTER_LOCATION)
        .withFuelBudgetInLiters(5.0)
return ReachableRangeQueryBuilder.create(Locations.AMSTERDAM_CENTER)
        .withFuelBudgetInLiters(VEHICLE_FUEL_BUDGET)

and pass it to the Routing API:

_

routingApi.findReachableRange(
        reachableRangeQueryFactory.createReachableRangeQueryForCombustion(),
        reachableRangeResultListener);
disposable.set(routingApi.findReachableRange(reachableRangeQuery)
        .subscribeOn(workingScheduler)
        .observeOn(resultScheduler)
        .subscribe(
                { response -> result.value = Resource.success(response) },
                { error -> result.value = Resource.error(null, Error(error.message)) }
        )
)

Setup of the common params for a Reachable Range query:

_

.withVehicleWeightInKg(1600)
.withCurrentFuelInLiters(43.0)
.withFuelEnergyDensityInMJoulesPerLiter(34.2)
.withAuxiliaryPowerInLitersPerHour(1.7)
.withAccelerationEfficiency(0.33)
.withDecelerationEfficiency(0.33)
.withUphillEfficiency(0.33)
.withDownhillEfficiency(0.33)
.withConstantSpeedConsumptionInLitersPerHundredKm(consumption)
.withVehicleEngineType(VehicleEngineType.COMBUSTION)
.withVehicleWeightInKg(VEHICLE_WEIGHT)
.withCurrentFuelInLiters(VEHICLE_CURRENT_FUEL)
.withFuelEnergyDensityInMJoulesPerLiter(FUEL_ENERGY_DENSITY)
.withAuxiliaryPowerInLitersPerHour(VEHICLE_AUXILIARY_POWER)
.withAccelerationEfficiency(VEHICLE_EFFICIENCY)
.withDecelerationEfficiency(VEHICLE_EFFICIENCY)
.withUphillEfficiency(VEHICLE_EFFICIENCY)
.withDownhillEfficiency(VEHICLE_EFFICIENCY)
.withConstantSpeedConsumptionInLitersPerHundredKm(consumption)
.withVehicleEngineType(VehicleEngineType.COMBUSTION)

Setup of the Reachable Range specific params for the query:

_

return ReachableRangeQueryBuilder.create(Locations.AMSTERDAM_CENTER_LOCATION)
        .withFuelBudgetInLiters(5.0)
return ReachableRangeQueryBuilder.create(Locations.AMSTERDAM_CENTER)
        .withFuelBudgetInLiters(VEHICLE_FUEL_BUDGET)

The result can be observed with ReachableRangeResultListener:

_

protected ReachableRangeResultListener reachableRangeResultListener = new ReachableRangeResultListener() {
    @Override
    public void onReachableRangeResponse(ReachableRangeResponse response) {
        doActionOnReachableRangeResponse(response);
    }

    @Override
    public void onReachableRangeError(Throwable error) {
        doActionOnReachableRangeError();
    }
};
private val reachableRangeResultListener = object : ReachableRangeResultListener {
    override fun onReachableRangeResponse(reachableRangeResponse: ReachableRangeResponse) {
        processReachableRangeResults(reachableRangeResponse)
    }

    override fun onReachableRangeError(error: Throwable) {
        Resource.error(null, Error(error.message))
    }
}

 

image

Fuel budget: 5 liters

image

Energy budget: 5 kWh

image

Time budget: 2h

You can use the output of the returned set of locations for other interacting use cases e.g., searching for places on the route to one (many) reachable point(s) with Search along the route or within the polygon boundaries with the Geometry search features of the Maps SDK.

You are here