Skip to content

calculate_isolines

calculate_isolines(
    thresholds: IsolineThresholds,
    *,
    config_overrides: Optional[GeoRoutesClientConfig] = None,
    allow: Optional[IsolineAllowOptions] = None,
    arrival_time: Optional[TimestampWithTimezoneOffset] = None,
    avoid: Optional[IsolineAvoidanceOptions] = None,
    depart_now: Optional[SensitiveBoolean] = None,
    departure_time: Optional[TimestampWithTimezoneOffset] = None,
    destination: Optional[Position] = None,
    destination_options: Optional[IsolineDestinationOptions] = None,
    isoline_geometry_format: Optional[GeometryFormat] = None,
    isoline_granularity: Optional[IsolineGranularityOptions] = None,
    key: Optional[ApiKey] = None,
    optimize_isoline_for: Optional[IsolineOptimizationObjective] = None,
    optimize_routing_for: Optional[RoutingObjective] = None,
    origin: Optional[Position] = None,
    origin_options: Optional[IsolineOriginOptions] = None,
    traffic: Optional[IsolineTrafficOptions] = None,
    travel_mode: Optional[IsolineTravelMode] = None,
    travel_mode_options: Optional[IsolineTravelModeOptions] = None,
) -> CalculateIsolinesResponse

Calculates areas that can be reached within specified time or distance thresholds from a given point. For example, you can use this operation to determine the area within a 30-minute drive of a store location, find neighborhoods within walking distance of a school, or identify delivery zones based on drive time.

Isolines (also known as isochrones for time-based calculations) are useful for various applications including:

  • Service area visualization - Show customers the area you can serve within promised delivery times

  • Site selection - Analyze potential business locations based on population within travel distance

  • Site selection - Determine areas that can be reached within specified response times

Route preferences such as avoiding toll roads or ferries are treated as preferences rather than absolute restrictions. If a viable route cannot be calculated while honoring all preferences, some may be ignored.

For more information, see Calculate isolines in the Amazon Location Service Developer Guide.

Parameters:

  • allow (Optional[IsolineAllowOptions], default: None ) –

    Enables special road types or features that should be considered for routing even if they might be restricted by default for the selected travel mode. These include high-occupancy vehicle and toll lanes.

  • arrival_time (Optional[TimestampWithTimezoneOffset], default: None ) –

    Determine areas from which Destination can be reached by this time, taking into account predicted traffic conditions and working backward to account for congestion patterns. This attribute cannot be used together with DepartureTime or DepartNow. Specified as an ISO-8601 timestamp with timezone offset.

    Time format: YYYY-MM-DDThh:mm:ss.sssZ | YYYY-MM-DDThh:mm:ss.sss+hh:mm

    Examples:

    2020-04-22T17:57:24Z

    2020-04-22T17:57:24+02:00

  • avoid (Optional[IsolineAvoidanceOptions], default: None ) –

    Specifies road types, features, or areas to avoid (if possible) when calculating reachable areas. These are treated as preferences rather than strict constraints—if a route cannot be calculated without using an avoided feature, that avoidance preference may be ignored.

  • depart_now (Optional[SensitiveBoolean], default: None ) –

    When true, uses the current time as the departure time and takes current traffic conditions into account. This attribute cannot be used together with DepartureTime or ArrivalTime.

  • departure_time (Optional[TimestampWithTimezoneOffset], default: None ) –

    Determine areas that can be reached when departing at this time, taking into account predicted traffic conditions. This attribute cannot be used together with ArrivalTime or DepartNow. Specified as an ISO-8601 timestamp with timezone offset.

    Time format:YYYY-MM-DDThh:mm:ss.sssZ | YYYY-MM-DDThh:mm:ss.sss+hh:mm

    Examples:

    2020-04-22T17:57:24Z

    2020-04-22T17:57:24+02:00

  • destination (Optional[Position], default: None ) –

    An optional destination point, specified as [longitude, latitude] coordinates. When provided, the service calculates areas from which this destination can be reached within the specified thresholds. This reverses the usual isoline calculation to show areas that could reach your location, rather than areas you could reach from your location. Either Origin or Destination must be provided.

  • destination_options (Optional[IsolineDestinationOptions], default: None ) –

    Options that control how the destination point is matched to the road network and how routes can approach it. These options help improve travel time accuracy by accounting for real-world access to the destination.

  • isoline_geometry_format (Optional[GeometryFormat], default: None ) –

    The format of the returned IsolineGeometry.

    Default value:FlexiblePolyline

  • isoline_granularity (Optional[IsolineGranularityOptions], default: None ) –

    Controls the detail level of the generated isolines. Higher granularity produces smoother shapes but requires more processing time and results in larger responses.

  • key (Optional[ApiKey], default: None ) –

    An Amazon Location Service API Key with access to this action. If omitted, the request must be signed using Signature Version 4.

  • optimize_isoline_for (Optional[IsolineOptimizationObjective], default: None ) –

    Controls the trade-off between calculation speed and isoline precision. Choose FastCalculation for quicker results with less detail, AccurateCalculation for more precise results, or BalancedCalculation for a middle ground.

    Default value: BalancedCalculation

  • optimize_routing_for (Optional[RoutingObjective], default: None ) –

    Determines whether routes prioritize shortest travel time (FastestRoute) or shortest physical distance (ShortestRoute) when calculating reachable areas.

    Default value: FastestRoute

  • origin (Optional[Position], default: None ) –

    The starting point for isoline calculations, specified as [longitude, latitude] coordinates. For example, this could be a store location, service center, or any point from which you want to calculate reachable areas. Either Origin or Destination must be provided.

  • origin_options (Optional[IsolineOriginOptions], default: None ) –

    Options that control how the origin point is matched to the road network and how routes can depart from it. These options help improve travel time accuracy by accounting for real-world access from the origin.

  • thresholds (IsolineThresholds) –

    The distance or time thresholds used to determine reachable areas. You can specify up to five thresholds (which all must be the same type) to calculate multiple isolines in a single request. For example, to determine the areas that are reachable within 10 and 20 minutes of the origin, specify time thresholds of 600 and 1200 seconds.

    You incur a calculation charge for each threshold. Using a large number of thresholds in a request can lead to unexpected charges. For more information, see Routes pricing in the Amazon Location Service Developer Guide.

  • traffic (Optional[IsolineTrafficOptions], default: None ) –

    Configures how real-time and historical traffic data affects isoline calculations. Traffic patterns can significantly impact reachable areas, especially during peak hours.

  • travel_mode (Optional[IsolineTravelMode], default: None ) –

    The mode of transportation to use for calculations. This affects which road types or features can be used, estimated speed, and the traffic levels that are applied.

    • Car—Standard passenger vehicle routing using roads accessible to cars

    • Pedestrian—Walking routes using pedestrian paths, sidewalks, and crossings

    • Scooter—Light two-wheeled vehicle routing using roads and paths accessible to scooters

    • Truck—Commercial truck routing considering vehicle dimensions, weight restrictions, and hazardous material regulations

    The mode Scooter also applies to motorcycles; set this to Scooter when calculating isolines for motorcycles.

    Default value: Car

  • travel_mode_options (Optional[IsolineTravelModeOptions], default: None ) –

    Additional attributes that refine how reachable areas are calculated based on specific vehicle characteristics. These options help produce more accurate results by accounting for real-world constraints and capabilities.

    For example:

    • For trucks (Truck), specify dimensions, weight limits, and hazardous cargo restrictions to ensure isolines only include roads that can physically and legally accommodate the vehicle

    • For cars (Car), set maximum speed capabilities or indicate high-occupancy vehicle eligibility to better estimate reachable areas

    • For scooters (Scooter), specify engine type and speed limitations to more accurately model their travel capabilities

    Without these options, calculations use default assumptions that may not match your specific use case.

Raises:

Source code in docs_src/capo_geo_routes/_services/geo_routes.py
def calculate_isolines(
    self,
    thresholds: "capo_geo_routes.types.isoline_thresholds.IsolineThresholds",
    *,
    config_overrides: Optional[GeoRoutesClientConfig] = None,
    allow: Optional[
        "capo_geo_routes.types.isoline_allow_options.IsolineAllowOptions"
    ] = None,
    arrival_time: Optional[
        "capo_geo_routes.types.timestamp_with_timezone_offset.TimestampWithTimezoneOffset"
    ] = None,
    avoid: Optional[
        "capo_geo_routes.types.isoline_avoidance_options.IsolineAvoidanceOptions"
    ] = None,
    depart_now: Optional[
        "capo_geo_routes.types.sensitive_boolean.SensitiveBoolean"
    ] = None,
    departure_time: Optional[
        "capo_geo_routes.types.timestamp_with_timezone_offset.TimestampWithTimezoneOffset"
    ] = None,
    destination: Optional["capo_geo_routes.types.position.Position"] = None,
    destination_options: Optional[
        "capo_geo_routes.types.isoline_destination_options.IsolineDestinationOptions"
    ] = None,
    isoline_geometry_format: Optional[
        "capo_geo_routes.types.geometry_format.GeometryFormat"
    ] = None,
    isoline_granularity: Optional[
        "capo_geo_routes.types.isoline_granularity_options.IsolineGranularityOptions"
    ] = None,
    key: Optional["capo_geo_routes.types.api_key.ApiKey"] = None,
    optimize_isoline_for: Optional[
        "capo_geo_routes.types.isoline_optimization_objective.IsolineOptimizationObjective"
    ] = None,
    optimize_routing_for: Optional[
        "capo_geo_routes.types.routing_objective.RoutingObjective"
    ] = None,
    origin: Optional["capo_geo_routes.types.position.Position"] = None,
    origin_options: Optional[
        "capo_geo_routes.types.isoline_origin_options.IsolineOriginOptions"
    ] = None,
    traffic: Optional[
        "capo_geo_routes.types.isoline_traffic_options.IsolineTrafficOptions"
    ] = None,
    travel_mode: Optional[
        "capo_geo_routes.types.isoline_travel_mode.IsolineTravelMode"
    ] = None,
    travel_mode_options: Optional[
        "capo_geo_routes.types.isoline_travel_mode_options.IsolineTravelModeOptions"
    ] = None,
) -> "capo_geo_routes.types.calculate_isolines_response.CalculateIsolinesResponse":
    """<p>Calculates areas that can be reached within specified time or distance thresholds from a given point. For example, you can use this operation to determine the area within a 30-minute drive of a store location, find neighborhoods within walking distance of a school, or identify delivery zones based on drive time.</p> <p>Isolines (also known as isochrones for time-based calculations) are useful for various applications including:</p> <ul> <li> <p>Service area visualization - Show customers the area you can serve within promised delivery times</p> </li> <li> <p>Site selection - Analyze potential business locations based on population within travel distance</p> </li> <li> <p>Site selection - Determine areas that can be reached within specified response times</p> </li> </ul> <note> <p>Route preferences such as avoiding toll roads or ferries are treated as preferences rather than absolute restrictions. If a viable route cannot be calculated while honoring all preferences, some may be ignored.</p> </note> <p>For more information, see <a href="https://docs.aws.amazon.com/location/latest/developerguide/calculate-isolines.html">Calculate isolines</a> in the <i>Amazon Location Service Developer Guide</i>.</p>

    Args:
        allow: <p>Enables special road types or features that should be considered for routing even if they might be restricted by default for the selected travel mode. These include high-occupancy vehicle and toll lanes.</p>
        arrival_time: <p>Determine areas from which <code>Destination</code> can be reached by this time, taking into account predicted traffic conditions and working backward to account for congestion patterns. This attribute cannot be used together with <code>DepartureTime</code> or <code>DepartNow</code>. Specified as an ISO-8601 timestamp with timezone offset.</p> <p>Time format: <code>YYYY-MM-DDThh:mm:ss.sssZ | YYYY-MM-DDThh:mm:ss.sss+hh:mm</code> </p> <p>Examples:</p> <p> <code>2020-04-22T17:57:24Z</code> </p> <p> <code>2020-04-22T17:57:24+02:00</code> </p>
        avoid: <p>Specifies road types, features, or areas to avoid (if possible) when calculating reachable areas. These are treated as preferences rather than strict constraints—if a route cannot be calculated without using an avoided feature, that avoidance preference may be ignored.</p>
        depart_now: <p>When true, uses the current time as the departure time and takes current traffic conditions into account. This attribute cannot be used together with <code>DepartureTime</code> or <code>ArrivalTime</code>.</p>
        departure_time: <p>Determine areas that can be reached when departing at this time, taking into account predicted traffic conditions. This attribute cannot be used together with <code>ArrivalTime</code> or <code>DepartNow</code>. Specified as an ISO-8601 timestamp with timezone offset.</p> <p>Time format:<code>YYYY-MM-DDThh:mm:ss.sssZ | YYYY-MM-DDThh:mm:ss.sss+hh:mm</code> </p> <p>Examples:</p> <p> <code>2020-04-22T17:57:24Z</code> </p> <p> <code>2020-04-22T17:57:24+02:00</code> </p>
        destination: <p>An optional destination point, specified as <code>[longitude, latitude]</code> coordinates. When provided, the service calculates areas from which this destination can be reached within the specified thresholds. This reverses the usual isoline calculation to show areas that could reach your location, rather than areas you could reach from your location. Either <code>Origin</code> or <code>Destination</code> must be provided.</p>
        destination_options: <p>Options that control how the destination point is matched to the road network and how routes can approach it. These options help improve travel time accuracy by accounting for real-world access to the destination.</p>
        isoline_geometry_format: <p>The format of the returned IsolineGeometry. </p> <p>Default value:<code>FlexiblePolyline</code> </p>
        isoline_granularity: <p>Controls the detail level of the generated isolines. Higher granularity produces smoother shapes but requires more processing time and results in larger responses.</p>
        key: <p>An Amazon Location Service API Key with access to this action. If omitted, the request must be signed using Signature Version 4.</p>
        optimize_isoline_for: <p>Controls the trade-off between calculation speed and isoline precision. Choose <code> FastCalculation</code> for quicker results with less detail, <code>AccurateCalculation</code> for more precise results, or <code>BalancedCalculation</code> for a middle ground.</p> <p>Default value: <code>BalancedCalculation</code> </p>
        optimize_routing_for: <p>Determines whether routes prioritize shortest travel time (<code>FastestRoute</code>) or shortest physical distance (<code>ShortestRoute</code>) when calculating reachable areas.</p> <p>Default value: <code>FastestRoute</code> </p>
        origin: <p>The starting point for isoline calculations, specified as <code>[longitude, latitude]</code> coordinates. For example, this could be a store location, service center, or any point from which you want to calculate reachable areas. Either <code>Origin</code> or <code>Destination</code> must be provided.</p>
        origin_options: <p>Options that control how the origin point is matched to the road network and how routes can depart from it. These options help improve travel time accuracy by accounting for real-world access from the origin.</p>
        thresholds: <p>The distance or time thresholds used to determine reachable areas. You can specify up to five thresholds (which all must be the same type) to calculate multiple isolines in a single request. For example, to determine the areas that are reachable within 10 and 20 minutes of the origin, specify time thresholds of 600 and 1200 seconds.</p> <p>You incur a calculation charge for each threshold. Using a large number of thresholds in a request can lead to unexpected charges. For more information, see <a href="https://docs.aws.amazon.com/location/latest/developerguide/routes-pricing.html">Routes pricing</a> in the <i>Amazon Location Service Developer Guide</i>.</p>
        traffic: <p>Configures how real-time and historical traffic data affects isoline calculations. Traffic patterns can significantly impact reachable areas, especially during peak hours.</p>
        travel_mode: <p>The mode of transportation to use for calculations. This affects which road types or features can be used, estimated speed, and the traffic levels that are applied.</p> <ul> <li> <p> <code>Car</code>—Standard passenger vehicle routing using roads accessible to cars</p> </li> <li> <p> <code>Pedestrian</code>—Walking routes using pedestrian paths, sidewalks, and crossings</p> </li> <li> <p> <code>Scooter</code>—Light two-wheeled vehicle routing using roads and paths accessible to scooters</p> </li> <li> <p> <code>Truck</code>—Commercial truck routing considering vehicle dimensions, weight restrictions, and hazardous material regulations</p> </li> </ul> <note> <p>The mode <code>Scooter</code> also applies to motorcycles; set this to <code>Scooter</code> when calculating isolines for motorcycles.</p> </note> <p>Default value: <code>Car</code> </p>
        travel_mode_options: <p>Additional attributes that refine how reachable areas are calculated based on specific vehicle characteristics. These options help produce more accurate results by accounting for real-world constraints and capabilities.</p> <p>For example:</p> <ul> <li> <p>For trucks (<code>Truck</code>), specify dimensions, weight limits, and hazardous cargo restrictions to ensure isolines only include roads that can physically and legally accommodate the vehicle</p> </li> <li> <p>For cars (<code>Car</code>), set maximum speed capabilities or indicate high-occupancy vehicle eligibility to better estimate reachable areas</p> </li> <li> <p>For scooters (<code>Scooter</code>), specify engine type and speed limitations to more accurately model their travel capabilities</p> </li> </ul> <p>Without these options, calculations use default assumptions that may not match your specific use case.</p>

    Raises:
        capo_geo_routes.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient access to perform this action.</p>
        capo_geo_routes.errors.internal_server_exception.InternalServerException: <p>The request processing has failed because of an unknown error, exception or failure.</p>
        capo_geo_routes.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_geo_routes.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by an AWS service.</p>
        capo_geo_routes.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_geo_routes.types.calculate_isolines_request.CalculateIsolinesRequest]",
    ) -> OperationResponse[
        "capo_geo_routes.types.calculate_isolines_response.CalculateIsolinesResponse"
    ]:
        import capo_geo_routes._operations.routes_service.calculate_isolines

        output, http_response = (
            capo_geo_routes._operations.routes_service.calculate_isolines.calculate_isolines(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_geo_routes.types.calculate_isolines_request.CalculateIsolinesRequest",
    ) -> dict[str, Any]:
        import capo_geo_routes.types.calculate_isolines_request

        return capo_geo_routes.types.calculate_isolines_request.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_geo_routes.types.calculate_isolines_response.CalculateIsolinesResponse",
    ) -> dict[str, Any]:
        import capo_geo_routes.types.calculate_isolines_response

        return capo_geo_routes.types.calculate_isolines_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CalculateIsolines",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_geo_routes.types.calculate_isolines_request.CalculateIsolinesRequest = {
        "thresholds": thresholds
    }
    if allow is not None:
        input_["allow"] = allow
    if arrival_time is not None:
        input_["arrival_time"] = arrival_time
    if avoid is not None:
        input_["avoid"] = avoid
    if depart_now is not None:
        input_["depart_now"] = depart_now
    if departure_time is not None:
        input_["departure_time"] = departure_time
    if destination is not None:
        input_["destination"] = destination
    if destination_options is not None:
        input_["destination_options"] = destination_options
    if isoline_geometry_format is not None:
        input_["isoline_geometry_format"] = isoline_geometry_format
    if isoline_granularity is not None:
        input_["isoline_granularity"] = isoline_granularity
    if key is not None:
        input_["key"] = key
    if optimize_isoline_for is not None:
        input_["optimize_isoline_for"] = optimize_isoline_for
    if optimize_routing_for is not None:
        input_["optimize_routing_for"] = optimize_routing_for
    if origin is not None:
        input_["origin"] = origin
    if origin_options is not None:
        input_["origin_options"] = origin_options
    if traffic is not None:
        input_["traffic"] = traffic
    if travel_mode is not None:
        input_["travel_mode"] = travel_mode
    if travel_mode_options is not None:
        input_["travel_mode_options"] = travel_mode_options

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output