From 30001b68a77b92c2a99930557c0076487dceba60 Mon Sep 17 00:00:00 2001 From: Mario de Frutos Date: Tue, 1 Mar 2016 16:47:49 +0100 Subject: [PATCH 1/5] Routing functions docs --- doc/routing_functions.md | 45 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 doc/routing_functions.md 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 (duration, length, the_geom) SELECT duration, length, shape FROM cdb_route_point_to_point('POINT(-3.70237112 40.41706163)'::geometry,'POINT(-3.69909883 40.41236875)'::geometry, 'car') +``` +##### Update the geometry field with the calculated route shape + +```bash +UPDATE
SET the_geom = (SELECT shape FROM cdb_route_point_to_point('POINT(-3.70237112 40.41706163)'::geometry,'POINT(-3.69909883 40.41236875)'::geometry, 'car', ARRAY['mode_type=shortest']::text[])) +``` + +### Optional routing parameters + +The optional value parameters must be passed using the format: `option=value`. + +Name | Type | Description | Accepted values +--- | --- | --- | --- +`mode_type` | `text` | Type of route calculation | `shortest` (this option only apply to the car mode) \ No newline at end of file From 14d02fd63fa5f28ea404b4f72fab3b374c6bb11e Mon Sep 17 00:00:00 2001 From: csobier Date: Tue, 5 Apr 2016 15:48:57 -0400 Subject: [PATCH 2/5] added link to mapzen routing --- doc/routing_functions.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/routing_functions.md b/doc/routing_functions.md index 733eb82..b82f2ff 100644 --- a/doc/routing_functions.md +++ b/doc/routing_functions.md @@ -1,6 +1,6 @@ -# Routing functions +# 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). +The following functions provide turn-by-turn capabilities to calculate the route from one point to another using different modes, such as a car or bicycle. Currently, only the [Mapzen routing provider](https://mapzen.com/documentation/turn-by-turn/api-reference/#mapzen-turn-by-turn-routing-service-api-reference) is available through CartoDB. ### cdb_route_point_to_point(_origin geometry(Point), destination geometry(Point), mode text, [options text[], units text]_) @@ -42,4 +42,4 @@ The optional value parameters must be passed using the format: `option=value`. Name | Type | Description | Accepted values --- | --- | --- | --- -`mode_type` | `text` | Type of route calculation | `shortest` (this option only apply to the car mode) \ No newline at end of file +`mode_type` | `text` | Type of route calculation | `shortest` (this option only applies to the car transport mode) \ No newline at end of file From ea24aa938f94b696eb1c76f2cb9fe6e8aaf355f8 Mon Sep 17 00:00:00 2001 From: csobier Date: Mon, 11 Apr 2016 08:21:26 -0400 Subject: [PATCH 3/5] added link in overview to quickstart rregarding mapzen setup --- doc/routing_functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/routing_functions.md b/doc/routing_functions.md index b82f2ff..dc6f275 100644 --- a/doc/routing_functions.md +++ b/doc/routing_functions.md @@ -1,6 +1,6 @@ # Routing Functions -The following functions provide turn-by-turn capabilities to calculate the route from one point to another using different modes, such as a car or bicycle. Currently, only the [Mapzen routing provider](https://mapzen.com/documentation/turn-by-turn/api-reference/#mapzen-turn-by-turn-routing-service-api-reference) is available through CartoDB. +The following functions provide turn-by-turn capabilities to calculate the route from one point to another using different modes, such as a car or bicycle. Currently, only the [Mapzen routing service](http://docs.cartodb.com/cartodb-platform/dataservices-api/quickstart/#using-mapzen-for-geocoding-and-routing) is available. ### cdb_route_point_to_point(_origin geometry(Point), destination geometry(Point), mode text, [options text[], units text]_) From ee9e5aba388820c1cf1b6646f1080f0d3db6708c Mon Sep 17 00:00:00 2001 From: csobier Date: Mon, 11 Apr 2016 10:21:45 -0400 Subject: [PATCH 4/5] updated renamed link --- doc/routing_functions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/routing_functions.md b/doc/routing_functions.md index dc6f275..e4e3b76 100644 --- a/doc/routing_functions.md +++ b/doc/routing_functions.md @@ -1,6 +1,6 @@ # Routing Functions -The following functions provide turn-by-turn capabilities to calculate the route from one point to another using different modes, such as a car or bicycle. Currently, only the [Mapzen routing service](http://docs.cartodb.com/cartodb-platform/dataservices-api/quickstart/#using-mapzen-for-geocoding-and-routing) is available. +The following functions provide turn-by-turn capabilities to calculate the route from one point to another using different modes, such as a car or bicycle. Currently, only the [Mapzen routing service](http://docs.cartodb.com/cartodb-platform/dataservices-api/quickstart/#using-mapzen-services) is available. ### cdb_route_point_to_point(_origin geometry(Point), destination geometry(Point), mode text, [options text[], units text]_) @@ -42,4 +42,4 @@ The optional value parameters must be passed using the format: `option=value`. Name | Type | Description | Accepted values --- | --- | --- | --- -`mode_type` | `text` | Type of route calculation | `shortest` (this option only applies to the car transport mode) \ No newline at end of file +`mode_type` | `text` | Type of route calculation | `shortest` (this option only applies to the car transport mode) From 187fe8f849e504996722cfac55b3a5eb3fe6a501 Mon Sep 17 00:00:00 2001 From: csobier Date: Tue, 12 Apr 2016 14:35:05 -0400 Subject: [PATCH 5/5] updated routing functions description --- doc/routing_functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/routing_functions.md b/doc/routing_functions.md index e4e3b76..b15a710 100644 --- a/doc/routing_functions.md +++ b/doc/routing_functions.md @@ -1,6 +1,6 @@ # Routing Functions -The following functions provide turn-by-turn capabilities to calculate the route from one point to another using different modes, such as a car or bicycle. Currently, only the [Mapzen routing service](http://docs.cartodb.com/cartodb-platform/dataservices-api/quickstart/#using-mapzen-services) is available. +Routing is the navigation from a defined start location to a defined end location. The calculated results are displayed as turn-by-turn directions on your map, based on the transportation mode that you specified. Routing services through CartoDB are available by requesting a single function in the Data Services API. ### cdb_route_point_to_point(_origin geometry(Point), destination geometry(Point), mode text, [options text[], units text]_)