Class ProximityService

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

public class ProximityService extends CercaliaClient
Service for finding nearby points of interest using the Cercalia Proximity API.

This service provides methods to find POIs near a center point, optionally filtered by category and with routing distance/time calculations.


 ProximityService service = new ProximityService(config);
 Coordinate center = new Coordinate(41.3851, 2.1734);
 
 // 1. Find nearest POIs (e.g. gas stations)
 ProximityResult result = service.findNearest(ProximityOptions.builder(center)
     .categories("D00GASP")
     .count(5)
     .maxRadius(10000) // 10km
     .build());

 // 2. Find nearest POIs with routing info (distance/time)
 ProximityResult routingResult = service.findNearestWithRouting(center, "D00GASP", 
     ProximityRouteWeight.TIME, 5);
 
See Also:
  • Constructor Details

    • ProximityService

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

    • findNearest

      @NotNull public @NotNull ProximityResult findNearest(@NotNull @NotNull ProximityOptions options)
      Find nearest POIs from a center point.
      Parameters:
      options - the search options
      Returns:
      the proximity search result
      Throws:
      CercaliaException - if the request fails
    • findNearestAsync

      @NotNull public @NotNull CompletableFuture<ProximityResult> findNearestAsync(@NotNull @NotNull ProximityOptions options)
      Find nearest POIs asynchronously.
      Parameters:
      options - the search options
      Returns:
      CompletableFuture with the proximity result
    • findNearestByCategory

      @NotNull public @NotNull ProximityResult findNearestByCategory(@NotNull @NotNull Coordinate center, @NotNull @NotNull String categoryCode, int count)
      Find nearest POIs by category.
      Parameters:
      center - the center coordinate
      categoryCode - the category code
      count - the number of results to return (default: 5)
      Returns:
      the proximity search result
      Throws:
      CercaliaException - if the request fails
    • findNearestByCategory

      @NotNull public @NotNull ProximityResult findNearestByCategory(@NotNull @NotNull Coordinate center, @NotNull @NotNull String categoryCode)
      Find nearest POIs by category with default count of 5.
      Parameters:
      center - the center coordinate
      categoryCode - the category code
      Returns:
      the proximity search result
      Throws:
      CercaliaException - if the request fails
    • findNearestWithRouting

      @NotNull public @NotNull ProximityResult findNearestWithRouting(@NotNull @NotNull Coordinate center, @NotNull @NotNull String categoryCode, @NotNull @NotNull ProximityRouteWeight weight, int count)
      Find nearest POIs with routing distance/time.
      Parameters:
      center - the center coordinate
      categoryCode - the category code
      weight - the routing weight (time or distance)
      count - the number of results to return
      Returns:
      the proximity search result
      Throws:
      CercaliaException - if the request fails
    • findNearestWithRouting

      @NotNull public @NotNull ProximityResult findNearestWithRouting(@NotNull @NotNull Coordinate center, @NotNull @NotNull String categoryCode)
      Find nearest POIs with routing time (default count of 5).
      Parameters:
      center - the center coordinate
      categoryCode - the category code
      Returns:
      the proximity search result
      Throws:
      CercaliaException - if the request fails