lds
This module contains functions and procedures that make use of location data services, such as geocoding, reverse geocoding, isolines and routing computation.
For manual installations of the CARTO Analytics Toolbox, after installing it for the first time, and before using any LDS function you need to call the SETUP procedure to configure the LDS and gateway functions. It also optionally sets default credentials.
Credentials
Your CARTO account has annual quotas assigned for each LDS service that are used up by every call to the LDS functions and procedures in the Analytics Toolbox.
Accordingly, the use of these functions and procedures requires providing authorization credentials to prevent fraudulent usage. Two parameters are needed:
api_base_urlThe API base url is simply the address through which you can access all the services of your CARTO account, and it depends on the region or premises where your account is located. Usually it will be this one:https://gcp-us-east1.api.carto.com.api_access_tokenThis token is an API Access Token that is allowed to use the LDS API. You must keep this secret! Anyone that has access to this token can use up the LDS quota assigned to your account.
Both the API base url and your API access token can be accessed through the developers section of the CARTO user interface. The API base url is displayed inside this section while for the API access token you will have to create a new API access token allowing the LDS API.
For more information about CARTO for developers, please check our documentation for Developers.
If default credentials are provided to the SETUP procedure, you can simply omit the credential parameters when calling the LDS functions (they default to NULL), and the credentials configured during SETUP will be used.
tip
To check that everything works correctly, without spending any credits, make a call to the GET_LDS_QUOTA_INFO function. You can enter the following in your Oracle SQL client:
SELECT carto.GET_LDS_QUOTA_INFO() FROM DUAL;Note that if you haven't set up default LDS credentials with SETUP you'll need to provide them when calling the LDS functions:
SELECT carto.GET_LDS_QUOTA_INFO(
'<my-api-base-url>',
'<my-api-access-token>'
) FROM DUAL;You should get a JSON response like this, with the available services and the quotas:
[
{
"used_quota": 10,
"annual_quota": 100000,
"providers": {
"geocoding": "tomtom",
"isolines": "here",
"routing":"tomtom"
}
}
]LDS quota is an annual quota that defines how much geocoding and isolines you can compute. Each geocoded row or computed isolines counts as one LDS quota unit. The single element in the result of GET_LDS_QUOTA_INFO will show your LDS quota for the current annual period (annual_quota), how much you've spent (used_quota), and which LDS providers are in use.
This also will allow you to verify that you have the right credentials, the AT is installed correctly and the service is working.
GEOCODE_TABLE
warning
This function consumes LDS quota. Each call consumes as many units of quota as the number of rows your input table has. Before running, we recommend checking the size of the data to be geocoded and your available quota using the GET_LDS_QUOTA_INFO function.
Description
Geocodes an input table by adding an user defined column geom_column with the geographic coordinates (latitude and longitude) corresponding to a given address column. This procedure also adds a carto_geocode_metadata column with additional information of the geocoding result in JSON format. It geocodes sequentially the table in chunks of 100 rows. If the input table already contains a geometry column with the name geom_column, only those rows with NULL values in it will be geocoded.
Input parameters
input_table:VARCHAR2name of the table to be geocoded. Please make sure you have enough permissions to alter this table, as this procedure will add two columns to it to store the geocoding result.address_column:VARCHAR2name of the column from the input table that contains the addresses to be geocoded.geom_column(optional):VARCHAR2column name for the output geometry column. Defaults to'geom'.country(optional):VARCHAR2name of the country in ISO 3166-1 alpha-2. Defaults to''.options(optional):VARCHAR2containing a valid JSON with the different options. In addition to the options targeted at the geocoding service described below, a boolean optioncarto_force_geocode(false by default) can be used to force geocoding rows that already have a non-null value ingeom_column. Valid options are described in the table below. If no options are indicated then 'default' values would be applied.ProviderOptionDescriptionAlllanguageA
VARCHAR2that specifies the language of the geocoding in RFC 4647 format.api_base_url(optional):VARCHAR2url of the API where the customer account is stored.api_access_token(optional):VARCHAR2an API Access Token that is allowed to use the LDS API.
Examples
GEOCODE_REVERSE_TABLE
warning
This function consumes LDS quota. Each call consumes as many units of quota as the number of rows your input table has. Before running, we recommend checking the size of the data to be geocoded and your available quota using the GET_LDS_QUOTA_INFO function.
Description
Reverse-geocodes an input table by adding an user defined column address_column with the addresses for a given point location column. It geocodes sequentially the table in chunks of 10 rows. If the input table already contains a column with the name address_column, only those rows with NULL values in it will be reverse-geocoded.
Input parameters
input_table:VARCHAR2name of the table to be reverse-geocoded. Please make sure you have enough permissions to alter this table, as this procedure will add a column to it to store the reverse geocoding result.geom_column(optional):SDO_GEOMETRYcolumn name for the geometry column that contains the points to be reverse-geocoded. Defaults to'geom'.address_column:VARCHAR2name of the column where the computed addresses will be stored. It defaults to'address', and it is created on the input table if it doesn't exist.language(optional):VARCHAR2language in which results should be returned. Defaults to''. The effect and interpretation of this parameter depends on the LDS provider assigned to your account.options(optional):VARCHAR2containing a valid JSON with the different options. No options are allowed currently, so this value will not be taken into account.api_base_url(optional):VARCHAR2url of the API where the customer account is stored.api_access_token(optional):VARCHAR2an API Access Token that is allowed to use the LDS API.
Examples
CREATE_ISOLINES
warning
This function consumes LDS quota. Each call consumes as many units of quota as the number of rows your input table or query has. Before running, we recommend checking the size of the data and your available quota using the GET_LDS_QUOTA_INFO function.
Description
Calculates the isolines (polygons) from given origins (points) in a table or query. It creates a new table with the columns of the input table or query except the geom_column plus the isolines in the column geom (if the input already contains a geom column, it will be overwritten). It calculates isolines sequentially in chunks of N rows, N being the optimal batch size for this datawarehouse and the specific LDS provider that you are using.
Note that the term isoline is used here in a general way to refer to the areas that can be reached from a given origin point within the given travel time or distance (depending on the range_type parameter).
Note that the parameters are named travel_mode and range_value instead of mode and range because both mode and range are reserved words in Oracle.
Input parameters
input_table:VARCHAR2name of the input table or query.output_table:VARCHAR2qualified name of the output table, e.g.<my-schema>.<my-output-table>. The process will fail if the table already exists.geom_column:VARCHAR2column name for the origin geometry column.travel_mode:VARCHAR2type of transport. The supported modes depend on the provider:HERE: 'walk', 'car', 'truck', 'taxi', 'bus', 'private_bus'.TomTom: 'walk', 'car', 'bike', 'motorbike', 'truck', 'taxi', 'bus', 'van'.TravelTime: 'walk', 'car', 'bike', 'public_transport', 'coach', 'bus', 'train', 'ferry'.Mapbox: 'walk', 'car', 'bike'.
range_value:NUMBERrange of the isoline in seconds (forrange_type'time') or meters (forrange_type'distance').range_type:VARCHAR2type of range. Supported: 'time' (for isochrones), 'distance' (for isodistances).options(optional):VARCHAR2containing a valid JSON with the different options. Valid options are described in the table below. If no options are indicated then 'default' values would be applied.ProviderOptionDescriptionHEREarrival_timeA
VARCHAR2that specifies the time of arrival. If the value is set, a reverse isoline is calculated. If set to"any", then time-dependent effects will not be taken into account. It cannot be used in combination withdeparture_time. Supported:"any","now"and date-time as"<YYYY-MM-DD>T<hh:mm:ss>".HEREdeparture_timeDefault:
"any". AVARCHAR2that specifies the time of departure. If set to"any", then time-dependent effects will not be taken into account. It cannot be used in combination witharrival_time. Supported:"any","now"and date-time as"<YYYY-MM-DD>T<hh:mm:ss>".HEREoptimize_forDefault:
"balanced". AVARCHAR2that specifies how isoline calculation is optimized. Supported:"quality"(calculation of isoline focuses on quality, that is, the graph used for isoline calculation has higher granularity generating an isoline that is more precise),"performance"(calculation of isoline is performance-centric, quality of isoline is reduced to provide better performance) and"balanced"(calculation of isoline takes a balanced approach averaging between quality and performance).HERErouting_modeDefault:
"fast". AVARCHAR2that specifies which optimization is applied during isoline calculation. Supported:"fast"(route calculation from start to destination optimized by travel time. In many cases, the route returned by the fast mode may not be the route with the fastest possible travel time. For example, the routing service may favor a route that remains on a highway, even if a faster travel time can be achieved by taking a detour or shortcut through an inconvenient side road) and"short"(route calculation from start to destination disregarding any speed information. In this mode, the distance of the route is minimized, while keeping the route sensible. This includes, for example, penalizing turns. Because of that, the resulting route will not necessarily be the one with minimal distance).TomTomdeparture_timeDefault:
"now". AVARCHAR2that specifies the time of departure. Supported:"now"and date-time as"<YYYY-MM-DD>T<hh:mm:ss>".TomTomtrafficDefault:
false. ABOOLEANthat specifies if all available traffic information will be taken into consideration. Supported:trueandfalse.TravelTimelevel_of_detailA JSON string. In the most typical case, you will want to use a string in the form
{ scale_type: 'simple_numeric', level: -N }, withNbeing the detail level (-8 by default). Higher Ns (more negative levels) will simplify the polygons more but will reduce performance. There are other ways of setting the level of detail. Check the TravelTime docs for more info.TravelTimedeparture_timeDefault:
"now". AVARCHAR2that specifies the time of departure. Supported:"now"and date-time as"<YYYY-MM-DD>T<hh:mm:ss>Z".api_base_url(optional):VARCHAR2url of the API where the customer account is stored.api_access_token(optional):VARCHAR2an API Access Token that is allowed to use the LDS API.
warning
Before running, we recommend checking your provider using the GET_LDS_QUOTA_INFO function. Notice that some of the parameters are provider dependant. Please contact your CARTO representative if you have questions regarding the service provider configured in your organization.
Examples
CREATE_H3_ISOLINES
warning
This function consumes LDS quota. Each call consumes as many units of quota as the number of rows your input table or query has. Before running, we recommend checking the size of the data and your available quota using the GET_LDS_QUOTA_INFO function.
warning
This procedure requires the TravelTime provider. If your organization uses a different isolines provider, the procedure will raise an error.
Description
Calculates H3 isolines (isochrones represented as H3 cells) from given origins (points) in a table or query. Unlike the standard CREATE_ISOLINES procedure which returns polygon geometries, this procedure returns an array of H3 cells with travel time information for each cell.
It creates a new table with the columns of the input table or query except the geom_column, with each H3 cell unnested into a separate row containing h3, h3_min, h3_max, and h3_mean as scalar values. It calculates H3 isolines sequentially in chunks of N rows, N being the optimal batch size for this datawarehouse.
The output table will contain a column named carto_isoline_metadata with error information for each isoline result. Rows with errors will have NULL values in the H3 columns.
Note that the parameters are named travel_mode and range_value instead of mode and range because both mode and range are reserved words in Oracle.
Input parameters
input_table:VARCHAR2name of the input table or query.output_table:VARCHAR2qualified name of the output table, e.g.<my-schema>.<my-output-table>. The process will fail if the table already exists.geom_column:VARCHAR2column name for the origin geometry column.travel_mode:VARCHAR2type of transport. Supported modes for TravelTime: 'walk', 'car', 'bike', 'public_transport', 'coach', 'bus', 'train', 'ferry'.range_value:NUMBERrange of the isoline in seconds. Valid range for time: 60-36000 (1 minute to 10 hours).range_type:VARCHAR2type of range. Currently only 'time' is supported for H3 isolines.resolution:NUMBERH3 resolution level for the output cells. Valid range: 6-12.options(optional):VARCHAR2containing a valid JSON with the different options. Valid options are described in the table below. If no options are indicated then 'default' values would be applied.ProviderOptionDescriptionTravelTimelevel_of_detailA JSON string. In the most typical case, you will want to use a string in the form
{ scale_type: 'simple_numeric', level: -N }, withNbeing the detail level (-8 by default). Higher Ns (more negative levels) will simplify the results more but will reduce performance. Check the TravelTime docs for more info.TravelTimedeparture_timeDefault:
"now". AVARCHAR2that specifies the time of departure. Supported:"now"and date-time as"<YYYY-MM-DD>T<hh:mm:ss>Z".api_base_url(optional):VARCHAR2url of the API where the customer account is stored.api_access_token(optional):VARCHAR2an API Access Token that is allowed to use the LDS API.
Output Table Schema
The output table will contain all columns from the input table except geom_column, with each H3 cell as a separate row:
h3
VARCHAR2
H3 cell index.
h3_min
NUMBER
Minimum travel time in seconds for this H3 cell.
h3_max
NUMBER
Maximum travel time in seconds for this H3 cell.
h3_mean
NUMBER
Average travel time in seconds for this H3 cell.
carto_isoline_metadata
VARCHAR2
Error information, or NULL if successful.
Examples
CREATE_ROUTES
warning
This function consumes LDS quota. Each call consumes as many units of quota as the number of rows your input query has. Before running, we recommend checking the size of the data to be geocoded and your available quota using the GET_LDS_QUOTA_INFO function.
Description
Calculates the routes (line strings) between given origins and destinations (points) in a query. It creates a new table with the columns of the input query with the resulting route in the user defined column geom_column (if the input already contains a column named geom_column, it will be overwritten) and a carto_routing_metadata column with the response of the service provider except for the route geometry. It calculates routes sequentially in chunks of 100 rows.
Note that routes are calculated using the external LDS provider assigned to your CARTO account. Currently TomTom, HERE, and TravelTime are supported.
Note that the parameter is named travel_mode instead of mode because mode is a reserved word in Oracle.
Input parameters
input_table:VARCHAR2name of the input table or query, which must have columns namedoriginanddestinationof typeSDO_GEOMETRYand containing points. If a column namedwaypointsis also present, it should contain a VARCHAR2 with the coordinates of the desired intermediate points with the format"lon1,lat1:lon2,lat2...".output_table:VARCHAR2qualified name of the output table, e.g.<my-schema>.<my-output-table>. The process will fail if the table already exists.geom_column:VARCHAR2column name for generated routes geometry column.travel_mode:VARCHAR2type of transport. The supported modes depend on the provider:TomTom: 'car', 'pedestrian', 'bicycle', 'motorcycle', 'truck', 'taxi', 'bus', 'van'.HERE: 'car', 'truck', 'pedestrian', 'bicycle', 'scooter', 'taxi', 'bus', 'privateBus'.TravelTime: 'cycling', 'driving', 'walking', 'public_transport', 'coach', 'bus', 'train', 'ferry', 'driving+train', 'driving+ferry', 'cycling+ferry', 'cycling+public_transport'.
options(optional):VARCHAR2containing a valid JSON with optional parameters. This is intended for advanced use: additional parameters can be passed directly to the Routing provider by placing them in this JSON string. To find out what your provider is, check theGET_LDS_QUOTA_INFOfunction. The following are some of the most common parameters for each provider:TomTom:avoid: Specifies something that the route calculation should try to avoid when determining the route. Possible values (several of them can be used at the same time):tollRoadsmotorwaysferriesunpavedRoadscarpoolsalreadyUsedRoadsborderCrossingstunnelscarTrainslowEmissionZones
routeType: Specifies the type of optimization used when calculating routes. Possible values:fastest,shortest,short,eco,thrillingtraffic: Set to truetrueto consider all available traffic information during routing. Set tofalseotherwisedepartAt: The date and time of departure at the departure point. It should be specified in RFC 3339 format with an optional time zone offset.arriveAt: The date and time of arrival at the destination point. It should be specified in RFC 3339 format with an optional time zone offset.vehicleMaxspeed: Maximum speed of the vehicle in kilometers/hour.
HEREavoid: Elements or areas to avoid. Information about avoidance can be found heredepartureTime: The date and time of departure at the departure point. It should be specified in RFC 3339 format with an optional time zone offset.arrivalTime: The date and time of arrival at the destination point. It should be specified in RFC 3339 format with an optional time zone offset.language: The language to use. Supported language codes can be found here
TravelTimesnap_penalty: Controls whether walking time and distance from the departure location to the nearest road and from the nearest road to the arrival location are included in the route. Possible values:enabled(walking segments are added to the total travel time and distance),disabled(journey effectively starts and ends at the nearest points on the road network). Defaults todisabledfor driving modes andenabledfor other modes.
For more advanced usage, check the documentation of your provider's routing API.
api_base_url(optional):VARCHAR2url of the API where the customer account is stored.api_access_token(optional):VARCHAR2an API Access Token that is allowed to use the LDS API.
warning
Before running, we recommend checking your provider using the GET_LDS_QUOTA_INFO function. Notice that some of the parameters are provider dependant. Please contact your CARTO representative if you have questions regarding the service provider configured in your organization.
Examples
CREATE_ROUTING_MATRIX
warning
This function consumes LDS quota. Each call consumes as many units of quota as the number of rows of the origins table multiplied by the rows of destinations table. Before running, we recommend checking the size of the data used to create the routes and your available quota using the GET_LDS_QUOTA_INFO function.
Description
Calculates the routes (line strings) between given origins and destinations (points) in two table. It creates a new table with the cross join of the origin and destination geom columns adding the distance or time between the different routes. A carto_routing_matrix_metadata column will also be added containing pottential errors thrown by the service provider for particular origin-destination combinations.
Note that routes are calculated using the external LDS provider assigned to your CARTO account. Currently TomTom and TravelTime are supported.
Note that the parameter is named travel_mode instead of mode because mode is a reserved word in Oracle.
Input parameters
origins_table:VARCHAR2name of the origins input table or query.origins_geom_column:VARCHAR2column name for the origin geometry column.destinations_table:VARCHAR2name of the destinations input table or query.destinations_geom_column:VARCHAR2column name for the destination geometry column.output_table:VARCHAR2qualified name of the output table, e.g.<my-schema>.<my-output-table>. The process will fail if the table already exists.travel_mode:VARCHAR2type of transport. The supported modes depend on the provider:TomTom: 'car', 'truck', 'pedestrian'.TravelTime: 'cycling', 'driving', 'driving+train', 'driving+public_transport', 'public_transport', 'walking', 'coach', 'bus', 'train', 'ferry', 'driving+ferry', 'cycling+ferry', 'cycling+public_transport'.
options(optional):VARCHAR2containing a valid JSON with optional parameters. This is intended for advanced use: additional parameters can be passed directly to the Routing provider by placing them in this JSON string. To find out what your provider is, check theGET_LDS_QUOTA_INFOfunction. The following are some of the most common parameters for each provider:ProviderOptionDescriptionTomTomavoidDefault:
[]. AnARRAYthat specifies something that the route calculation should try to avoid when determining the route. Supported:["tollRoads"],["unpavedRoads"].TomTomdepartAtDefault:
"any". AVARCHAR2that specifies the time of departure. Supported:"now","any"and date-time as"<YYYY-MM-DD>T<hh:mm:ss>".TomTomrouteTypeDefault:
"fastest". AVARCHAR2that specifies the type of optimization used when calculating routes. Supported:"fastest","shortest".TomTomtrafficDefault:
historical. AVARCHAR2that decides how traffic is considered for computing routes. Supported:historicalandlive.livemay not be used in conjunction withdepartAt=any.TomTomvehicleMaxSpeedDefault:
0. ANUMBERthat specifies the maximum speed of the vehicle in kilometers/hour. Supported: a value in the range [0, 250]. A value of0means that an appropriate value for the vehicle will be determined and applied during route planning.TravelTimedeparture_timeDefault:
"now". AVARCHAR2that specifies the time of departure. Supported:"now"and date-time as"<YYYY-MM-DD>T<hh:mm:ss>Z".TravelTimetravel_timeDefault:
14400(4 hours). ANUMBERthat specifies the maximum travel time in seconds. Supported: a value in the range [0, 14400].For more advanced usage, check the documentation of your provider's matrix routing API.
api_base_url(optional):VARCHAR2url of the API where the customer account is stored.api_access_token(optional):VARCHAR2an API Access Token that is allowed to use the LDS API.The following are options provided by CARTO in order to adjust the procedure performance:
OptionDescriptioncarto_origins_batch_sizeDefault:
TomTom: 20,TravelTime: 1. ANUMBERthat specifies the number of origins rows to process in each batch. Increasing this value in the case of TravelTime can cause some origins-destinations combinations to be skipped when the origin is not found.carto_destinations_batch_sizeDefault:
TomTom: 20,TravelTime: 400. ANUMBERthat specifies the number of destinations rows to process in each batch.carto_batch_sizeA
NUMBERused as a fallback applied to both origins and destinations whencarto_origins_batch_sizeand/orcarto_destinations_batch_sizeare not set.
warning
We recommend the product of carto_origins_batch_size x carto_destinations_batch_size to be lower than 400 to ensure that the batches sizes is small enough to be processed.
warning
Before running, we recommend checking your provider using the GET_LDS_QUOTA_INFO function. Notice that some of the parameters are provider dependant. Please contact your CARTO representative if you have questions regarding the service provider configured in your organization.
Return type
The results are stored in the table named <output_table>, which contains the following columns:
origin_geom:SDO_GEOMETRYthe origin geometry.destination_geom:SDO_GEOMETRYthe destination geometry.route_distance:NUMBERthe distance of the route in meters.route_duration:NUMBERthe duration of the route in seconds.carto_routing_matrix_metadata:VARCHAR2possible errors thrown by the service provider for particular origin-destination combinations.
When generating the output table origin-destination combinations, duplicated or null geometries will not be processed.
Examples
Examples with TomTom specific parameters:
Example with batch sizes:
GEOCODE
warning
This function consumes LDS quota. Each call consumes one unit of quota. Before running, check the size of the data to be geocoded and make sure you store the result in a table to avoid misuse of the quota. To check the information about available and consumed quota use the function GET_LDS_QUOTA_INFO.
We recommend using this function only with an input of up to 10 records. In order to geocode larger sets of addresses, we strongly recommend using the GEOCODE_TABLE procedure. Likewise, in order to materialize the results in a table.
Description
Geocodes an address into an SDO_GEOMETRY point with its geographic coordinates (latitude and longitude).
Input parameters
address:VARCHAR2input address to geocode.country(optional):VARCHAR2name of the country in ISO 3166-1 alpha-2. Defaults to''.options(optional):VARCHAR2containing a valid JSON with the different options. Valid options are described in the table below. If no options are indicated then 'default' values would be applied.ProviderOptionDescriptionAlllanguageA
VARCHAR2that specifies the language of the geocoding in RFC 4647 format.api_base_url(optional):VARCHAR2url of the API where the customer account is stored.api_access_token(optional):VARCHAR2an API Access Token that is allowed to use the LDS API.
Return type
SDO_GEOMETRY
Examples
GEOCODE_REVERSE
warning
This function consumes LDS quota. Each call consumes one unit of quota. Before running, check the size of the data to be reverse geocoded and make sure you store the result in a table to avoid misuse of the quota. To check the information about available and consumed quota use the function GET_LDS_QUOTA_INFO.
We recommend using this function only with an input of up to 10 records. In order to reverse-geocode larger sets of locations, we strongly recommend using the GEOCODE_REVERSE_TABLE procedure. Likewise, in order to materialize the results in a table.
Description
Performs a reverse geocoding of the point received as input.
Input parameters
geom:SDO_GEOMETRYinput point for which to obtain the address.language(optional):VARCHAR2language in which results should be returned. Defaults to''. The effect and interpretation of this parameter depends on the LDS provider assigned to your account.options(optional):VARCHAR2containing a valid JSON with the different options. No options are allowed currently, so this value will not be taken into account.api_base_url(optional):VARCHAR2url of the API where the customer account is stored.api_access_token(optional):VARCHAR2an API Access Token that is allowed to use the LDS API.
Return type
VARCHAR2
Examples
ISOLINE
warning
This function consumes LDS quota. Each call consumes one unit quota. Before running, check the size of the data and make sure you store the result in a table to avoid misuse of the quota. To check the information about available and consumed quota use the function GET_LDS_QUOTA_INFO.
We recommend using this function only with an input of up to 10 records. In order to calculate isolines for larger sets of locations, we strongly recommend using the CREATE_ISOLINES procedure. Likewise, in order to materialize the results in a table.
Description
Calculates the isoline polygon from a given point.
Note that the parameters are named travel_mode and range_value instead of mode and range because both mode and range are reserved words in Oracle.
Input parameters
origin:SDO_GEOMETRYorigin point of the isoline.travel_mode:VARCHAR2type of transport. The supported modes depend on the provider:HERE: 'walk', 'car', 'truck', 'taxi', 'bus', 'private_bus'.TomTom: 'walk', 'car', 'bike', 'motorbike', 'truck', 'taxi', 'bus', 'van'.TravelTime: 'walk', 'car', 'bike', 'public_transport', 'coach', 'bus', 'train', 'ferry'.Mapbox: 'walk', 'car', 'bike'.
range_value:NUMBERrange of the isoline in seconds (forrange_type'time') or meters (forrange_type'distance').range_type:VARCHAR2type of range. Supported: 'time' (for isochrones), 'distance' (for isodistances).options(optional):VARCHAR2containing a valid JSON with the different options. Valid options are described in the table below. If no options are indicated then 'default' values would be applied.ProviderOptionDescriptionHEREarrival_timeA
VARCHAR2that specifies the time of arrival. If the value is set, a reverse isoline is calculated. If set to"any", then time-dependent effects will not be taken into account. It cannot be used in combination withdeparture_time. Supported:"any","now"and date-time as"<YYYY-MM-DD>T<hh:mm:ss>".HEREdeparture_timeDefault:
"now". AVARCHAR2that specifies the time of departure. If set to"any", then time-dependent effects will not be taken into account. It cannot be used in combination witharrival_time. Supported:"any","now"and date-time as"<YYYY-MM-DD>T<hh:mm:ss>".HEREoptimize_forDefault:
"balanced". AVARCHAR2that specifies how isoline calculation is optimized. Supported:"quality","performance"and"balanced".HERErouting_modeDefault:
"fast". AVARCHAR2that specifies which optimization is applied during isoline calculation. Supported:"fast"and"short".TomTomdeparture_timeDefault:
"now". AVARCHAR2that specifies the time of departure. Supported:"any","now"and date-time as"<YYYY-MM-DD>T<hh:mm:ss>".TomTomtrafficDefault:
true. A boolean that specifies if all available traffic information will be taken into consideration.TravelTimelevel_of_detailA JSON string. In the most typical case, use
{ scale_type: 'simple_numeric', level: -N }, withNbeing the detail level (-8 by default). Check the TravelTime docs for more info.TravelTimedeparture_timeDefault:
"now". AVARCHAR2that specifies the time of departure. Supported:"now"and date-time as"<YYYY-MM-DD>T<hh:mm:ss>Z".api_base_url(optional):VARCHAR2url of the API where the customer account is stored.api_access_token(optional):VARCHAR2an API Access Token that is allowed to use the LDS API.
warning
Before running, we recommend checking your provider using the GET_LDS_QUOTA_INFO function. Notice that some of the parameters are provider dependant. Please contact your CARTO representative if you have questions regarding the service provider configured in your organization.
Return type
SDO_GEOMETRY
Examples
H3_ISOLINE
warning
This function consumes LDS quota. Each call consumes one unit quota. Before running, check the size of the data and make sure you store the result in a table to avoid misuse of the quota. To check the information about available and consumed quota use the function GET_LDS_QUOTA_INFO.
We recommend using this function only with an input of up to 10 records. In order to calculate H3 isolines for larger sets of locations, we strongly recommend using the CREATE_H3_ISOLINES procedure. Likewise, in order to materialize the results in a table.
warning
This function requires the TravelTime provider. If your organization uses a different isolines provider, the function will raise an error.
Description
Calculates H3 isolines (isochrones represented as H3 cells) from a given point. Unlike the standard ISOLINE function which returns a polygon geometry, this function returns a pipelined table of H3 cells with travel time information for each cell. Consume it via TABLE(H3_ISOLINE(...)).
Input parameters
origin:SDO_GEOMETRYorigin point of the isoline.travel_mode:VARCHAR2type of transport. Supported modes for TravelTime: 'walk', 'car', 'bike', 'public_transport', 'coach', 'bus', 'train', 'ferry'.range_value:NUMBERrange of the isoline in seconds. Valid range for time: 60-36000 (1 minute to 10 hours).range_type:VARCHAR2type of range. Currently only 'time' is supported for H3 isolines.resolution:NUMBERH3 resolution level for the output cells. Valid range: 6-12.options(optional):VARCHAR2containing a valid JSON with the different options. Valid options are described in the table below. If no options are indicated then 'default' values would be applied.ProviderOptionDescriptionTravelTimelevel_of_detailA JSON string. In the most typical case, use
{ scale_type: 'simple_numeric', level: -N }, withNbeing the detail level (-8 by default). Check the TravelTime docs for more info.TravelTimedeparture_timeDefault:
"now". AVARCHAR2that specifies the time of departure. Supported:"now"and date-time as"<YYYY-MM-DD>T<hh:mm:ss>Z".api_base_url(optional):VARCHAR2url of the API where the customer account is stored.api_access_token(optional):VARCHAR2an API Access Token that is allowed to use the LDS API.
Return type
Pipelined table of LDS_H3_ISOLINE_CELL rows. Each row has:
h3
VARCHAR2(16)
H3 cell index.
h3_min
NUMBER
Minimum travel time in seconds to reach this H3 cell.
h3_max
NUMBER
Maximum travel time in seconds to reach this H3 cell.
h3_mean
NUMBER
Average travel time in seconds to reach this H3 cell.
Examples
GET_LDS_QUOTA_INFO
Description
Returns statistics about the LDS quota. LDS quota is an annual quota that defines how much geocoding and isolines you can compute. Each geocoded row or computed isolines counts as one LDS quota unit. The single element in the result of GET_LDS_QUOTA_INFO will show your LDS quota for the current annual period (annual_quota), how much you've spent (used_quota), and which LDS providers are in use.
Input parameters
api_base_url(optional):VARCHAR2url of the API where the customer account is stored.api_access_token(optional):VARCHAR2an API Access Token that is allowed to use the LDS API.
Return type
CLOB
Examples
Last updated
Was this helpful?
