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 for routes with a given route-type (e.g. fastest, eco, etc) but limits the range for the given budget and consumption parameters.
It uses Calculate Reachable Range API so you can find all details in the service documentation.

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

The example below shows a number of points that are reachable based on one of 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 code sample below for implementing 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 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 of 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 Geometry search features of Maps SDK.

You are here