diff --git a/doc/routing_functions.md b/doc/routing_functions.md new file mode 100644 index 0000000..733eb82 --- /dev/null +++ b/doc/routing_functions.md @@ -0,0 +1,45 @@ +# Routing functions + +The following functions provide routing capabilities to calculate the route from one point to another using differents modes like car or bicycle for example. This service uses the routing service defined for the user (currently, only the Mapzen routing service is available). + +### cdb_route_point_to_point(_origin geometry(Point), destination geometry(Point), mode text, [options text[], units text]_) + +#### Arguments + +Name | Type | Description | Accepted values +--- | --- | --- | --- +`origin` | `geometry(Point)` | Origin point, in 4326 projection, which defines the start location. | +`destination` | `geometry(Point)` | Destination point, in 4326 projection, which defines the end location. | +`mode` | `text` | Type of transport used to calculate the isolines. | `car`, `walk`, `bicycle` or `public_transport` +`options` | `text[]` | (Optional) Multiple options to add more capabilities to the analysis. See [Optional routing parameters](#optional-routing-parameters) for details. +`units` | `text` | Unit used to represent the length of the route. | `kilometers`, `miles`. By default is `kilometers` + + +#### Returns + +Name | Type | Description +--- | --- | --- +`duration` | `integer` | Duration in seconds of the calculated route. +`length` | `real` | Length in the defined unit in the `units` field. `kilometers` by default . +`the_geom` | `geometry(LineString)` | LineString geometry of the calculated route in the 4326 projection. + +#### Examples + +##### Insert the values from the calculated route in your table + +```bash +INSERT INTO