Skip to content

create_route_calculator async

create_route_calculator(
    calculator_name: ResourceName,
    data_source: str,
    *,
    config_overrides: Optional[AsyncLocationClientConfig] = None,
    pricing_plan: Optional[PricingPlan] = None,
    description: Optional[ResourceDescription] = None,
    tags: Optional[TagMap] = None,
) -> CreateRouteCalculatorResponse

This operation is no longer current and may be deprecated in the future. We recommend you upgrade to the Routes API V2 unless you require Grab data.

  • CreateRouteCalculator is part of a previous Amazon Location Service Routes API (version 1) which has been superseded by a more intuitive, powerful, and complete API (version 2).

  • The Routes API version 2 has a simplified interface that can be used without creating or managing route calculator resources.

  • If you are using an Amazon Web Services SDK or the Amazon Web Services CLI, note that the Routes API version 2 is found under geo-routes or geo_routes, not under location.

  • Since Grab is not yet fully supported in Routes API version 2, we recommend you continue using API version 1 when using Grab.

  • Start your version 2 API journey with the Routes V2 API Reference or the Developer Guide.

Creates a route calculator resource in your Amazon Web Services account.

You can send requests to a route calculator resource to estimate travel time, distance, and get directions. A route calculator sources traffic and road network data from your chosen data provider.

If your application is tracking or routing assets you use in your business, such as delivery vehicles or employees, you must not use Esri as your geolocation provider. See section 82 of the Amazon Web Services service terms for more details.

Parameters:

  • calculator_name (ResourceName) –

    The name of the route calculator resource.

    Requirements:

    • Can use alphanumeric characters (A–Z, a–z, 0–9) , hyphens (-), periods (.), and underscores (_).

    • Must be a unique Route calculator resource name.

    • No spaces allowed. For example, ExampleRouteCalculator.

  • data_source (str) –

    Specifies the data provider of traffic and road network data.

    This field is case-sensitive. Enter the valid values as shown. For example, entering HERE returns an error.

    Valid values include:

    For additional information , see Data providers on the Amazon Location Service Developer Guide.

  • pricing_plan (Optional[PricingPlan], default: None ) –

    No longer used. If included, the only allowed value is RequestBasedUsage.

  • description (Optional[ResourceDescription], default: None ) –

    The optional description for the route calculator resource.

  • tags (Optional[TagMap], default: None ) –

    Applies one or more tags to the route calculator resource. A tag is a key-value pair helps manage, identify, search, and filter your resources by labelling them.

    • For example: { "tag1" : "value1", "tag2" : "value2"}

    Format: "key" : "value"

    Restrictions:

    • Maximum 50 tags per resource

    • Each resource tag must be unique with a maximum of one value.

    • Maximum key length: 128 Unicode characters in UTF-8

    • Maximum value length: 256 Unicode characters in UTF-8

    • Can use alphanumeric characters (A–Z, a–z, 0–9), and the following characters: + - = . _ : / @.

    • Cannot use "aws:" as a prefix for a key.

Raises:

Source code in docs_src/capo_location/_services/async_location.py
async def create_route_calculator(
    self,
    calculator_name: "capo_location.types.resource_name.ResourceName",
    data_source: str,
    *,
    config_overrides: Optional[AsyncLocationClientConfig] = None,
    pricing_plan: Optional["capo_location.types.pricing_plan.PricingPlan"] = None,
    description: Optional[
        "capo_location.types.resource_description.ResourceDescription"
    ] = None,
    tags: Optional["capo_location.types.tag_map.TagMap"] = None,
) -> "capo_location.types.create_route_calculator_response.CreateRouteCalculatorResponse":
    """<important> <p>This operation is no longer current and may be deprecated in the future. We recommend you upgrade to the Routes API V2 unless you require Grab data.</p> <ul> <li> <p> <code>CreateRouteCalculator</code> is part of a previous Amazon Location Service Routes API (version 1) which has been superseded by a more intuitive, powerful, and complete API (version 2).</p> </li> <li> <p>The Routes API version 2 has a simplified interface that can be used without creating or managing route calculator resources.</p> </li> <li> <p>If you are using an Amazon Web Services SDK or the Amazon Web Services CLI, note that the Routes API version 2 is found under <code>geo-routes</code> or <code>geo_routes</code>, not under <code>location</code>.</p> </li> <li> <p>Since Grab is not yet fully supported in Routes API version 2, we recommend you continue using API version 1 when using Grab.</p> </li> <li> <p>Start your version 2 API journey with the Routes V2 <a href="/location/latest/APIReference/API_Operations_Amazon_Location_Service_Routes_V2.html">API Reference</a> or the <a href="/location/latest/developerguide/routes.html">Developer Guide</a>.</p> </li> </ul> </important> <p>Creates a route calculator resource in your Amazon Web Services account.</p> <p>You can send requests to a route calculator resource to estimate travel time, distance, and get directions. A route calculator sources traffic and road network data from your chosen data provider.</p> <note> <p>If your application is tracking or routing assets you use in your business, such as delivery vehicles or employees, you must not use Esri as your geolocation provider. See section 82 of the <a href="http://aws.amazon.com/service-terms">Amazon Web Services service terms</a> for more details.</p> </note>

    Args:
        calculator_name: <p>The name of the route calculator resource. </p> <p>Requirements:</p> <ul> <li> <p>Can use alphanumeric characters (A–Z, a–z, 0–9) , hyphens (-), periods (.), and underscores (_).</p> </li> <li> <p>Must be a unique Route calculator resource name.</p> </li> <li> <p>No spaces allowed. For example, <code>ExampleRouteCalculator</code>.</p> </li> </ul>
        data_source: <p>Specifies the data provider of traffic and road network data.</p> <note> <p>This field is case-sensitive. Enter the valid values as shown. For example, entering <code>HERE</code> returns an error.</p> </note> <p>Valid values include:</p> <ul> <li> <p> <code>Esri</code> – For additional information about <a href="https://docs.aws.amazon.com/location/previous/developerguide/esri.html">Esri</a>'s coverage in your region of interest, see <a href="https://doc.arcgis.com/en/arcgis-online/reference/network-coverage.htm">Esri details on street networks and traffic coverage</a>.</p> <p>Route calculators that use Esri as a data source only calculate routes that are shorter than 400 km.</p> </li> <li> <p> <code>Grab</code> – Grab provides routing functionality for Southeast Asia. For additional information about <a href="https://docs.aws.amazon.com/location/previous/developerguide/grab.html">GrabMaps</a>' coverage, see <a href="https://docs.aws.amazon.com/location/previous/developerguide/grab.html#grab-coverage-area">GrabMaps countries and areas covered</a>.</p> </li> <li> <p> <code>Here</code> – For additional information about <a href="https://docs.aws.amazon.com/location/previous/developerguide/HERE.html">HERE Technologies</a>' coverage in your region of interest, see <a href="https://developer.here.com/documentation/routing-api/dev_guide/topics/coverage/car-routing.html">HERE car routing coverage</a> and <a href="https://developer.here.com/documentation/routing-api/dev_guide/topics/coverage/truck-routing.html">HERE truck routing coverage</a>.</p> </li> </ul> <p>For additional information , see <a href="https://docs.aws.amazon.com/location/previous/developerguide/what-is-data-provider.html">Data providers</a> on the <i>Amazon Location Service Developer Guide</i>.</p>
        pricing_plan: <p>No longer used. If included, the only allowed value is <code>RequestBasedUsage</code>.</p>
        description: <p>The optional description for the route calculator resource.</p>
        tags: <p>Applies one or more tags to the route calculator resource. A tag is a key-value pair helps manage, identify, search, and filter your resources by labelling them.</p> <ul> <li> <p>For example: { <code>"tag1" : "value1"</code>, <code>"tag2" : "value2"</code>}</p> </li> </ul> <p>Format: <code>"key" : "value"</code> </p> <p>Restrictions:</p> <ul> <li> <p>Maximum 50 tags per resource</p> </li> <li> <p>Each resource tag must be unique with a maximum of one value.</p> </li> <li> <p>Maximum key length: 128 Unicode characters in UTF-8</p> </li> <li> <p>Maximum value length: 256 Unicode characters in UTF-8</p> </li> <li> <p>Can use alphanumeric characters (A–Z, a–z, 0–9), and the following characters: + - = . _ : / @. </p> </li> <li> <p>Cannot use "aws:" as a prefix for a key.</p> </li> </ul>

    Raises:
        capo_location.errors.access_denied_exception.AccessDeniedException: <p>The request was denied because of insufficient access or permissions. Check with an administrator to verify your permissions.</p>
        capo_location.errors.conflict_exception.ConflictException: <p>The request was unsuccessful because of a conflict.</p>
        capo_location.errors.internal_server_exception.InternalServerException: <p>The request has failed to process because of an unknown server error, exception, or failure.</p>
        capo_location.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The operation was denied because the request would exceed the maximum <a href="https://docs.aws.amazon.com/location/previous/developerguide/location-quotas.html">quota</a> set for Amazon Location Service.</p>
        capo_location.errors.throttling_exception.ThrottlingException: <p>The request was denied because of request throttling.</p>
        capo_location.errors.validation_exception.ValidationException: <p>The input failed to meet the constraints specified by the AWS service. </p>
        capo_location.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_location.types.create_route_calculator_request.CreateRouteCalculatorRequest]",
    ) -> AsyncOperationResponse[
        "capo_location.types.create_route_calculator_response.CreateRouteCalculatorResponse"
    ]:
        import capo_location._operations.location_service.create_route_calculator

        (
            output,
            http_response,
        ) = await capo_location._operations.location_service.create_route_calculator.async_create_route_calculator(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_location.types.create_route_calculator_response.CreateRouteCalculatorResponse",
    ) -> dict[str, Any]:
        import capo_location.types.create_route_calculator_response

        return (
            capo_location.types.create_route_calculator_response.redact_sensitive(
                output
            )
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateRouteCalculator", redact_output=_redact_output),
    )
    input_: capo_location.types.create_route_calculator_request.CreateRouteCalculatorRequest = {
        "calculator_name": calculator_name,
        "data_source": data_source,
    }
    if pricing_plan is not None:
        input_["pricing_plan"] = pricing_plan
    if description is not None:
        input_["description"] = description
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output