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
Destinationcan 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 withDepartureTimeorDepartNow. Specified as an ISO-8601 timestamp with timezone offset.Time format:
YYYY-MM-DDThh:mm:ss.sssZ | YYYY-MM-DDThh:mm:ss.sss+hh:mmExamples:
2020-04-22T17:57:24Z2020-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
DepartureTimeorArrivalTime. -
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
ArrivalTimeorDepartNow. Specified as an ISO-8601 timestamp with timezone offset.Time format:
YYYY-MM-DDThh:mm:ss.sssZ | YYYY-MM-DDThh:mm:ss.sss+hh:mmExamples:
2020-04-22T17:57:24Z2020-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. EitherOriginorDestinationmust 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
FastCalculationfor quicker results with less detail,AccurateCalculationfor more precise results, orBalancedCalculationfor 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. EitherOriginorDestinationmust 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
Scooteralso applies to motorcycles; set this toScooterwhen 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:
-
AccessDeniedException–You don't have sufficient access to perform this action.
-
InternalServerException–The request processing has failed because of an unknown error, exception or failure.
-
ThrottlingException–The request was denied due to request throttling.
-
ValidationException–The input fails to satisfy the constraints specified by an AWS service.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_geo_routes/_services/geo_routes.py
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 | |