24.6 SDO_GCDR.ELOC_ISO_POLYGON

Format

SDO_GCDR.ELOC_ISO_POLYGON(
  iso                     IN  VARCHAR2,
  start_address           IN  VARCHAR2,    
  country                 IN  VARCHAR2,
  cost                    IN  NUMBER,
  cost_unit               IN  VARCHAR2,
  vehicle_type            IN  VARCHAR2,    
  print_request_response  IN  VARCHAR2 DEFAULT 'FALSE');

or

SDO_GCDR.ELOC_ISO_POLYGON(
  iso                     IN  VARCHAR2,
  longitude               IN  NUMBER,
  latitude                IN  NUMBER,    
  cost                    IN  NUMBER,
  cost_unit               IN  VARCHAR2,
  vehicle_type            IN  VARCHAR2,    
  print_request_response  IN  VARCHAR2 DEFAULT 'FALSE');

Description

Computes the drive time polygon around an input location for the specified cost, and returns a JSON object that includes the cost, cost unit, and geometry of the polygon in GeoJSON format.

The input location can either be a single-line address or be specified as longitude and latitude.

Parameters

iso

Determines if it is a time-based or distance-based polygon.

Supported values are:
  • distance: This applies for a distance-based polygon.
  • time: This applies for a time-based polygon.
start_address

Complete start address (not formatted into separate fields).

country

ISO 2-character country code. See Country codes in ISO Online Browsing Platform (OBP) to view the list of supported codes.

longitude

Longitude value of the starting point.

latitude

Latitude value of the starting point.

cost

Distance or time bounds of the polygon.

cost_unit

Unit for cost.

Supported values are: mile, kilometer, km, meter, hour, minute, and second.

vehicle_type

Type of vehicle considered for computing the distance.

Supported values are: auto and truck

print_request_response

Determines if the request sent and response received are to be printed.

By default, the parameter value is 'FALSE'.

Usage Notes

Note:

The SDO_GCDR.ELOC_ISO_POLYGON function is only supported in Oracle Autonomous Database Serverless deployments.

In order to use this function on your Autonomous Database instance, ensure that you have been granted the required permission. See SDO_GCDR.ELOC_GRANT_ACCESS for more information.

The SDO_GCDR.ELOC_ISO_POLYGON function can accept one of the following sets of input parameters to compute the drive time polygon (as a JSON object) around a location:

  • Using an unformatted address: Provide the start_address parameter where the complete address is stored in a single field (that is, unformatted).
  • Using geographic coordinates: Provide the longitude and latitude parameters to determine the location.

Also, note that each parameter input can be a column from a table or view, or an explicit string or number value.

The following describes the schema for the JSON output:

{
  "type": "object",
  "properties": {
    "routeResponse": {
      "type": "object",
      "properties": {
        "driveTimePolygon": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "cost": {
              "type": "string"
            },
            "unit": {
              "type": "string"
            },
            "geometry": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string"
                },
                "coordinates": {
                  "type": "array",
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "number"
                      }
                    }
                  }
                }
              },
              "required": [..]
            }
          },
          "required": [..]
        }
      },
      "required": [..]
    }
  },
  "required": [..]
}

Example

The following example computes the drive time polygon around an address for an auto. Note that the output values for cost, unit, and polygon geometry are extracted from the resulting JSON object using the JSON_VALUE and JSON_QUERY functions:

WITH x AS
(SELECT SDO_GCDR.ELOC_ISO_POLYGON('time', '1 Oracle Drive, Nashua, NH', 'US', 1, 'minute', 'auto') AS t FROM DUAL)
 SELECT json_value(t, '$.routeResponse.driveTimePolygon.cost') AS cost,
        json_value(t, '$.routeResponse.driveTimePolygon.unit') AS unit,
        json_query(t, '$.routeResponse.driveTimePolygon.geometry' RETURNING clob) AS geom
FROM x;

1
minute
{"type":"Polygon","coordinates":[[[-71.46924,42.76051],[-71.46928,42.76],[-71.46919,42.75975],[-71.46911,42.75962],
                                  [-71.46899,42.7594],[-71.46974,42.75638],[-71.47012,42.75626],[-71.47038,42.75617],
                                  [-71.46688,42.7552],[-71.46602,42.75482],[-71.46409,42.75397],[-71.46244,42.75343],
                                  [-71.4618,42.75311],[-71.46102,42.7542],[-71.46054,42.75496],[-71.45947,42.75647],
                                  [-71.45924,42.75761],[-71.45815,42.75858],[-71.45741,42.75912],[-71.45813,42.75955],
                                  [-71.45959,42.76009],[-71.46187,42.76099],[-71.46227,42.76177],[-71.46266,42.76243],
                                  [-71.46354,42.76268],[-71.46447,42.76344],[-71.46639,42.76425],[-71.4668,42.76412],
                                  [-71.46668,42.76387],[-71.46683,42.7625],[-71.46732,42.76183],[-71.46924,42.76051]]]}