Class IsochroneService

java.lang.Object
com.cercalia.sdk.CercaliaClient
com.cercalia.sdk.services.IsochroneService

public class IsochroneService extends CercaliaClient
Service for calculating isochrones (service areas) using the Cercalia API.

An isochrone is a polygon representing the area reachable from a center point within a given time or distance constraint.


 IsochroneService service = new IsochroneService(config);
 Coordinate center = new Coordinate(41.3851, 2.1734);
 
 // 1. Calculate a single isochrone (e.g. 10 minutes)
 IsochroneResult result = service.calculate(center, IsochroneOptions.builder()
     .value(10)
     .weight(IsochroneWeight.TIME)
     .method(IsochroneMethod.CONCAVEHULL)
     .build());

 // 2. Calculate multiple concentric isochrones (e.g. 5, 10, 15 minutes)
 List<IsochroneResult> results = service.calculateMultiple(center, 
     new int[]{5, 10, 15}, IsochroneWeight.TIME);
 
See Also:
  • Constructor Details

    • IsochroneService

      public IsochroneService(@NotNull @NotNull CercaliaConfig config)
      Creates a new IsochroneService with the specified configuration.
      Parameters:
      config - the Cercalia configuration
  • Method Details

    • calculate

      @NotNull public @NotNull IsochroneResult calculate(@NotNull @NotNull Coordinate center, @NotNull @NotNull IsochroneOptions options)
      Calculate a single isochrone (service area) from a center point.
      Parameters:
      center - the center coordinate for the isochrone (WGS84)
      options - the isochrone calculation options (value, weight, method)
      Returns:
      IsochroneResult with WKT polygon geometry
      Throws:
      CercaliaException - if the request fails
      IllegalArgumentException - if value is not greater than zero
    • calculateAsync

      @NotNull public @NotNull CompletableFuture<IsochroneResult> calculateAsync(@NotNull @NotNull Coordinate center, @NotNull @NotNull IsochroneOptions options)
      Calculate a single isochrone asynchronously.
      Parameters:
      center - the center coordinate
      options - the isochrone calculation options
      Returns:
      CompletableFuture with the IsochroneResult
    • calculateMultiple

      @NotNull public @NotNull List<IsochroneResult> calculateMultiple(@NotNull @NotNull Coordinate center, @NotNull @org.jetbrains.annotations.NotNull int[] values, @NotNull @NotNull IsochroneWeight weight)
      Calculate multiple isochrones (concentric service areas) in a single API request.
      Parameters:
      center - the center coordinate (WGS84)
      values - array of values (e.g., [5, 10, 15] for 5, 10, 15 minutes)
      weight - the weight type (time or distance)
      Returns:
      list of IsochroneResult, one for each value
      Throws:
      CercaliaException - if the request fails
    • calculateMultiple

      @NotNull public @NotNull List<IsochroneResult> calculateMultiple(@NotNull @NotNull Coordinate center, @NotNull @org.jetbrains.annotations.NotNull int[] values, @NotNull @NotNull IsochroneWeight weight, @NotNull @NotNull IsochroneMethod method)
      Calculate multiple isochrones (concentric service areas) in a single API request.
      Parameters:
      center - the center coordinate (WGS84)
      values - array of values (e.g., [5, 10, 15] for 5, 10, 15 minutes)
      weight - the weight type (time or distance)
      method - the method for polygon calculation
      Returns:
      list of IsochroneResult, one for each value
      Throws:
      CercaliaException - if the request fails
    • calculateMultipleAsync

      @NotNull public @NotNull CompletableFuture<List<IsochroneResult>> calculateMultipleAsync(@NotNull @NotNull Coordinate center, @NotNull @org.jetbrains.annotations.NotNull int[] values, @NotNull @NotNull IsochroneWeight weight)
      Calculate multiple isochrones asynchronously.
      Parameters:
      center - the center coordinate
      values - array of values
      weight - the weight type
      Returns:
      CompletableFuture with list of IsochroneResult