From e5a72b81a5bdd82ffd039224e7887f5af6dd068f Mon Sep 17 00:00:00 2001 From: Carla Date: Fri, 12 Feb 2016 15:20:45 +0100 Subject: [PATCH 01/30] Create geocoder_service.md --- doc/geocoder_service.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/geocoder_service.md diff --git a/doc/geocoder_service.md b/doc/geocoder_service.md new file mode 100644 index 0000000..8deb175 --- /dev/null +++ b/doc/geocoder_service.md @@ -0,0 +1 @@ +# Geocoder service From 5ff5f4d0b3563b7913e20b0cbe002d9744e015ea Mon Sep 17 00:00:00 2001 From: Carla Date: Fri, 12 Feb 2016 15:21:06 +0100 Subject: [PATCH 02/30] Create routing_service.md --- doc/routing_service.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/routing_service.md diff --git a/doc/routing_service.md b/doc/routing_service.md new file mode 100644 index 0000000..7d7173b --- /dev/null +++ b/doc/routing_service.md @@ -0,0 +1 @@ +# Routing service From fdd2ecb5e14bb60a949c784858922d33f1ee3c01 Mon Sep 17 00:00:00 2001 From: Carla Date: Fri, 12 Feb 2016 15:22:02 +0100 Subject: [PATCH 03/30] Update and rename geocoder_service.md to geocoding_functions.md --- doc/geocoder_service.md | 1 - doc/geocoding_functions.md | 312 +++++++++++++++++++++++++++++++++++++ 2 files changed, 312 insertions(+), 1 deletion(-) delete mode 100644 doc/geocoder_service.md create mode 100644 doc/geocoding_functions.md diff --git a/doc/geocoder_service.md b/doc/geocoder_service.md deleted file mode 100644 index 8deb175..0000000 --- a/doc/geocoder_service.md +++ /dev/null @@ -1 +0,0 @@ -# Geocoder service diff --git a/doc/geocoding_functions.md b/doc/geocoding_functions.md new file mode 100644 index 0000000..503decf --- /dev/null +++ b/doc/geocoding_functions.md @@ -0,0 +1,312 @@ +# Geocoding functions + +The following geocoding functions are available, grouped by categories. + + +## Country geocoder + +This function provides a country geocoding service. It recognizes the names of the different countries from different synonyms, such as their English name, their endonym, or their ISO2 or ISO3 codes. + +### cdb_geocode_admin0_polygon(_country_name text_) + +#### Arguments + +Name | Type | Description +--- | --- | --- +`country_name` | `text` | Name of the country + +#### Returns + +Geometry (polygon, EPSG 4326) or null + +#### Example + +##### Select + +```bash +SELECT cdb_geocode_admin0_polygon('France') +``` + +##### Update + +```bash +UPDATE {tablename} SET the_geom = cdb_geocode_admin0_polygon({country_column}) +``` + + +## Level-1 Administrative regions geocoder + +The following functions provide a geocoding service for administrative regions of level 1 (or NUTS-1) such as states for the United States, regions in France or autonomous communities in Spain. + +### cdb_geocode_admin1_polygon(_admin1_name text_) + +#### Arguments + +Name | Type | Description +--- | --- | --- +`admin1_name` | `text` | Name of the province/state + +#### Returns + +Geometry (polygon, EPSG 4326) or null + +#### Example + +##### Select + +```bash +SELECT cdb_geocode_admin1_polygon('Alicante') +``` + +##### Update + +```bash +UPDATE {tablename} SET the_geom = cdb_geocode_admin1_polygon({province_column}) +``` + +### cdb_geocode_admin1_polygon(_admin1_name text, country_name text_) + +#### Arguments + +Name | Type | Description +--- | --- | --- +`admin1_name` | `text` | Name of the province/state +`country_name` | `text` | Name of the country in which the province/state is located + +#### Returns + +Geometry (polygon, EPSG 4326) or null + +#### Example + +##### Select + +```bash +SELECT cdb_geocode_admin1_polygon('Alicante', 'Spain') +``` + +##### Update + +```bash +UPDATE {tablename} SET the_geom = cdb_geocode_admin1_polygon({province_column}, {country_column}) +``` + + +## City geocoder + +The following functions provide a city geocoder service. It is recommended to use the more specific geocoding function -- the one that requires more parameters — in order for the result to be as accurate as possible when several cities share their name. + +### cdb_geocode_namedplace_point(_city_name text_) + +#### Arguments + +Name | Type | Description +--- | --- | --- +`city_name` | `text` | Name of the city + +#### Returns + +Geometry (point, EPSG 4326) or null + +#### Example + +##### Select + +```bash +SELECT cdb_geocode_namedplace_point('Barcelona') +``` + +##### Update + +```bash +UPDATE {tablename} SET the_geom = cdb_geocode_namedplace_point({city_column}) +``` + +### cdb_geocode_namedplace_point(_city_name text, country_name text_) + +#### Arguments + +Name | Type | Description +--- | --- | --- +`city_name` | `text` | Name of the city +`country_name` | `text` | Name of the country in which the city is located + +#### Returns + +Geometry (point, EPSG 4326) or null + +#### Example + +##### Select + +```bash +SELECT cdb_geocode_namedplace_point('Barcelona', 'Spain') +``` + +##### Update + +```bash +UPDATE {tablename} SET the_geom = cdb_geocode_namedplace_point({city_column}, 'Spain') +``` + +### cdb_geocode_namedplace_point(_city_name text, admin1_name text, country_name text_) + +#### Arguments + +Name | Type | Description +--- | --- | --- +`city_name` | `text` | Name of the city +`admin1_name` | `text` | Name of the province/state in which the city is located +`country_name` | `text` | Name of the country in which the city is located + +#### Returns + +Geometry (point, EPSG 4326) or null + +#### Example + +##### Select + +```bash +SELECT cdb_geocode_namedplace_point('New York', 'New York', 'USA') +``` + +##### Update + +```bash +UPDATE {tablename} SET the_geom = cdb_geocode_namedplace_point({city_column}, {province_column}, 'USA') +``` + +## Postal codes geocoder + +The following functions provide a postal code geocoding service that can be used to obtain points or polygon results. The postal code polygon geocoder covers the United States, France, Australia and Canada; a request for a different country will return an empty response. + +### cdb_geocode_postalcode_polygon(_postal_code text, country_name text_) + +#### Arguments + +Name | Type | Description +--- | --- | --- +`postal_code` | `text` | Postal code +`country_name` | `text` | Name of the country in which the postal code is located + +#### Returns + +Geometry (polygon, EPSG 4326) or null + +#### Example + +##### Select + +```bash +SELECT cdb_geocode_postalcode_polygon('11211', 'USA') +``` + +##### Update + +```bash +UPDATE {tablename} SET the_geom = cdb_geocode_postalcode_polygon({postal_code_column}, 'USA') +``` + +**Note:** For the USA, US Census ZCTAs are considered. + +### cdb_geocode_postalcode_point(_code text, country_name text_) + +#### Arguments + +Name | Type | Description +--- | --- | --- +`postal_code` | `text` | Postal code +`country_name` | `text` | Name of the country in which the postal code is located + +#### Returns + +Geometry (point, EPSG 4326) or null + +#### Example + +##### Select + +```bash +SELECT cdb_geocode_postalcode_point('11211', 'USA') +``` + +##### Update + +```bash +UPDATE {tablename} SET the_geom = cdb_geocode_postalcode_point({postal_code_column}, 'USA') +``` + +## IP addresses geocoder + +This function provides an IP address geocoding service, for both IPv4 and IPv6 addresses. + +### cdb_geocode_ipaddress_point(_ip_address text_) + +#### Arguments + +Name | Type | Description +--- | --- | --- +`ip_address` | `text` | Postal code +`country_name` | `text` | IPv4 or IPv6 address + +#### Returns + +Geometry (point, EPSG 4326) or null + +#### Example + +##### Select + +```bash +SELECT cdb_geocode_ipaddress_point('102.23.34.1') +``` + +##### Update + +```bash +UPDATE {tablename} SET the_geom = cdb_geocode_ipaddress_point('102.23.34.1') +``` +## Street-level geocoder + +This function provides a street-level geocoding service. This service uses the street level geocoder defined for the user (currently, only the Here geocoder is available). + +**This service is subject to quota limitations, and extra fees may apply.** Please view our [terms and conditions](https://cartodb.com/terms/) + +Be mindful of the following when using this function: + + - **One credit per function call will be consumed**, and the results are not cached. If the query applies to a N rows dataset, then N credits will be used. + - You are discouraged from using dynamic queries to the Geocoder API in your maps. This can result in credits consumption per map view. Note: **queries to the Geocoder API in your maps may be forbidden in the future**. + - You are advised to store results of Geocoder API queries into your datasets and refresh them as needed, so that you can have finer control on your credits' usage. + +### cdb_geocode_street_point(_search_text text, [city text], [state text], [country text]_) + +#### Arguments + +Name | Type | Description +--- | --- | --- +`searchtext` | `text` | searchtext contains free-form text containing address elements. You can specify the searchtext parameter by itself, or you can specify it with other parameters to narrow your search. For example, you can specify the state or country parameters, along with a free-form address in the searchtext field. +`city` | `text` | (Optional) Name of the city +`state` | `text` | (Optional) Name of the state +`country` | `text` | (Optional) Name of the country + +#### Returns + +Geometry (point, EPSG 4326) or null + +#### Example + +##### Select + +```bash +SELECT cdb_geocode_street_point('651 Lombard Street, San Francisco, California, United States') +SELECT cdb_geocode_street_point('651 Lombard Street', 'San Francisco') +SELECT cdb_geocode_street_point('651 Lombard Street', 'San Francisco', 'California') +SELECT cdb_geocode_street_point('651 Lombard Street', 'San Francisco', 'California', 'United States') +``` + +##### Update + +```bash +UPDATE {tablename} SET the_geom = cdb_geocode_street_point({street_name_column}) +``` From 2c2547ea2b6a1f915986b7a539ddc8f767144c6b Mon Sep 17 00:00:00 2001 From: Carla Date: Fri, 12 Feb 2016 15:22:26 +0100 Subject: [PATCH 04/30] Update and rename routing_service.md to routing_functions.md --- doc/routing_functions.md | 63 ++++++++++++++++++++++++++++++++++++++++ doc/routing_service.md | 1 - 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 doc/routing_functions.md delete mode 100644 doc/routing_service.md diff --git a/doc/routing_functions.md b/doc/routing_functions.md new file mode 100644 index 0000000..013e1ba --- /dev/null +++ b/doc/routing_functions.md @@ -0,0 +1,63 @@ + +# Routing functions + +The following rouging functions are available, grouped by categories. + +## Isolines + +This function provides an isolines generator sirves based on time or distance. + +### cdb_isodistance(_source geometry, mode text, range integer[], options text[]_) + +#### Arguments + +Name | Type | Description | Accepted values +--- | --- | --- | --- +`source` | `geometry` | Source point, in 4326 projection, taken as the start point +`mode` | `geometry` | Type of transport used to calculate the isolines. | `car` and `walk` +`range` | `integer[]` | Range of the isoline in meters +`options` | `text[]` | Multiple options to add more capabilities to the analysis. See the options section to know more. + +#### Options + +The options values must be pass in the following way: `option=value`. + +Name | Type | Description | Accepted values +--- | --- | --- | --- +`is_destination` | `boolean` | If is true the source point is the destination instead of the starting one. +`mode_type` | `text` | Type of route calculation | `shortest` or `fastest`. By default is `shortest` +`mode_traffic` | `text` | Use the traffic data to calculate the route. | `enabled` or `disabled`. By default is `disabled` +`singlecomponent` | `boolean` | If set to true the isoline service will always return single polygon, instead of creating a separate polygon for each ferry separated island. | `true` or `false`. Default value is false. +`resolution` | `text` | Allows to specify level of detail needed for the isoline polygon. Unit is meters per pixel. Higher resolution may cause increased response time from the service. +`maxpoints` | `text` | Allows to limit amount of points in the returned isoline. If isoline consists of multiple components, sum of points from all components is considered. Each component will have at least 2 points, so it is possible that more points than maxpoints value will be returned. This is in case when 2 * number of components is higher than maxpoints. Enlarging number of maxpoints may cause increased response time from the service. +`quality` | `text` | Allows to reduce the quality of the isoline in favor of the response time. | `1`, `2`, `3`. Default value is 1 and it is the best quality. + +#### Returns + +Name | Type | Description +--- | --- | --- +`center` | `geometry` | Source point, in 4326 projection, taken as the start point +`data_range` | `integer` | The range that belongs to the generated isoline. +`the_geom` | `geometry (multipolygon)` | Geometry of the generated isoline in 4326 projection. + +#### Example + +##### Select + +```bash +SELECT * FROM cdb_isodistance('POINT(-3.70568 40.42028)'::geometry, 'car', ARRAY[1000,2000]::integer[]); +SELECT * FROM cdb_isodistance('POINT(-3.70568 40.42028)'::geometry, 'walk', ARRAY[1000]::integer[], ARRAY['mode_traffic=enabled','quality=3']::text[]); +``` + +### cdb_isochrone(_source geometry, mode text, range integer[], options text[]_) + +This function uses the same parameters and info as the `cdb_isodistance` function with the difference that the range is measured in seconds instead of meters + +#### Example + +##### Select + +```bash +SELECT * FROM cdb_isochrone('POINT(-3.70568 40.42028)'::geometry, 'car', ARRAY[300,900,12000]::integer[]); +SELECT * FROM cdb_isochrone('POINT(-3.70568 40.42028)'::geometry, 'walk', ARRAY[300,900]::integer[], ARRAY['mode_traffic=enabled','quality=3']::text[]); +``` diff --git a/doc/routing_service.md b/doc/routing_service.md deleted file mode 100644 index 7d7173b..0000000 --- a/doc/routing_service.md +++ /dev/null @@ -1 +0,0 @@ -# Routing service From 4b7e9aa19eb3070a680fdb0ff5cd20b29ad14dd5 Mon Sep 17 00:00:00 2001 From: Carla Date: Fri, 12 Feb 2016 15:22:44 +0100 Subject: [PATCH 05/30] Delete reference.md --- doc/reference.md | 374 ----------------------------------------------- 1 file changed, 374 deletions(-) delete mode 100644 doc/reference.md diff --git a/doc/reference.md b/doc/reference.md deleted file mode 100644 index 065066b..0000000 --- a/doc/reference.md +++ /dev/null @@ -1,374 +0,0 @@ -# Geocoding functions - -The following geocoding functions are available, grouped by categories. - - -## Country geocoder - -This function provides a country geocoding service. It recognizes the names of the different countries from different synonyms, such as their English name, their endonym, or their ISO2 or ISO3 codes. - -### cdb_geocode_admin0_polygon(_country_name text_) - -#### Arguments - -Name | Type | Description ---- | --- | --- -`country_name` | `text` | Name of the country - -#### Returns - -Geometry (polygon, EPSG 4326) or null - -#### Example - -##### Select - -```bash -SELECT cdb_geocode_admin0_polygon('France') -``` - -##### Update - -```bash -UPDATE {tablename} SET the_geom = cdb_geocode_admin0_polygon({country_column}) -``` - - -## Level-1 Administrative regions geocoder - -The following functions provide a geocoding service for administrative regions of level 1 (or NUTS-1) such as states for the United States, regions in France or autonomous communities in Spain. - -### cdb_geocode_admin1_polygon(_admin1_name text_) - -#### Arguments - -Name | Type | Description ---- | --- | --- -`admin1_name` | `text` | Name of the province/state - -#### Returns - -Geometry (polygon, EPSG 4326) or null - -#### Example - -##### Select - -```bash -SELECT cdb_geocode_admin1_polygon('Alicante') -``` - -##### Update - -```bash -UPDATE {tablename} SET the_geom = cdb_geocode_admin1_polygon({province_column}) -``` - -### cdb_geocode_admin1_polygon(_admin1_name text, country_name text_) - -#### Arguments - -Name | Type | Description ---- | --- | --- -`admin1_name` | `text` | Name of the province/state -`country_name` | `text` | Name of the country in which the province/state is located - -#### Returns - -Geometry (polygon, EPSG 4326) or null - -#### Example - -##### Select - -```bash -SELECT cdb_geocode_admin1_polygon('Alicante', 'Spain') -``` - -##### Update - -```bash -UPDATE {tablename} SET the_geom = cdb_geocode_admin1_polygon({province_column}, {country_column}) -``` - - -## City geocoder - -The following functions provide a city geocoder service. It is recommended to use the more specific geocoding function -- the one that requires more parameters — in order for the result to be as accurate as possible when several cities share their name. - -### cdb_geocode_namedplace_point(_city_name text_) - -#### Arguments - -Name | Type | Description ---- | --- | --- -`city_name` | `text` | Name of the city - -#### Returns - -Geometry (point, EPSG 4326) or null - -#### Example - -##### Select - -```bash -SELECT cdb_geocode_namedplace_point('Barcelona') -``` - -##### Update - -```bash -UPDATE {tablename} SET the_geom = cdb_geocode_namedplace_point({city_column}) -``` - -### cdb_geocode_namedplace_point(_city_name text, country_name text_) - -#### Arguments - -Name | Type | Description ---- | --- | --- -`city_name` | `text` | Name of the city -`country_name` | `text` | Name of the country in which the city is located - -#### Returns - -Geometry (point, EPSG 4326) or null - -#### Example - -##### Select - -```bash -SELECT cdb_geocode_namedplace_point('Barcelona', 'Spain') -``` - -##### Update - -```bash -UPDATE {tablename} SET the_geom = cdb_geocode_namedplace_point({city_column}, 'Spain') -``` - -### cdb_geocode_namedplace_point(_city_name text, admin1_name text, country_name text_) - -#### Arguments - -Name | Type | Description ---- | --- | --- -`city_name` | `text` | Name of the city -`admin1_name` | `text` | Name of the province/state in which the city is located -`country_name` | `text` | Name of the country in which the city is located - -#### Returns - -Geometry (point, EPSG 4326) or null - -#### Example - -##### Select - -```bash -SELECT cdb_geocode_namedplace_point('New York', 'New York', 'USA') -``` - -##### Update - -```bash -UPDATE {tablename} SET the_geom = cdb_geocode_namedplace_point({city_column}, {province_column}, 'USA') -``` - -## Postal codes geocoder - -The following functions provide a postal code geocoding service that can be used to obtain points or polygon results. The postal code polygon geocoder covers the United States, France, Australia and Canada; a request for a different country will return an empty response. - -### cdb_geocode_postalcode_polygon(_postal_code text, country_name text_) - -#### Arguments - -Name | Type | Description ---- | --- | --- -`postal_code` | `text` | Postal code -`country_name` | `text` | Name of the country in which the postal code is located - -#### Returns - -Geometry (polygon, EPSG 4326) or null - -#### Example - -##### Select - -```bash -SELECT cdb_geocode_postalcode_polygon('11211', 'USA') -``` - -##### Update - -```bash -UPDATE {tablename} SET the_geom = cdb_geocode_postalcode_polygon({postal_code_column}, 'USA') -``` - -**Note:** For the USA, US Census ZCTAs are considered. - -### cdb_geocode_postalcode_point(_code text, country_name text_) - -#### Arguments - -Name | Type | Description ---- | --- | --- -`postal_code` | `text` | Postal code -`country_name` | `text` | Name of the country in which the postal code is located - -#### Returns - -Geometry (point, EPSG 4326) or null - -#### Example - -##### Select - -```bash -SELECT cdb_geocode_postalcode_point('11211', 'USA') -``` - -##### Update - -```bash -UPDATE {tablename} SET the_geom = cdb_geocode_postalcode_point({postal_code_column}, 'USA') -``` - -## IP addresses geocoder - -This function provides an IP address geocoding service, for both IPv4 and IPv6 addresses. - -### cdb_geocode_ipaddress_point(_ip_address text_) - -#### Arguments - -Name | Type | Description ---- | --- | --- -`ip_address` | `text` | Postal code -`country_name` | `text` | IPv4 or IPv6 address - -#### Returns - -Geometry (point, EPSG 4326) or null - -#### Example - -##### Select - -```bash -SELECT cdb_geocode_ipaddress_point('102.23.34.1') -``` - -##### Update - -```bash -UPDATE {tablename} SET the_geom = cdb_geocode_ipaddress_point('102.23.34.1') -``` -## Street-level geocoder - -This function provides a street-level geocoding service. This service uses the street level geocoder defined for the user (currently, only the Here geocoder is available). - -**This service is subject to quota limitations, and extra fees may apply.** Please view our [terms and conditions](https://cartodb.com/terms/) - -Be mindful of the following when using this function: - - - **One credit per function call will be consumed**, and the results are not cached. If the query applies to a N rows dataset, then N credits will be used. - - You are discouraged from using dynamic queries to the Geocoder API in your maps. This can result in credits consumption per map view. Note: **queries to the Geocoder API in your maps may be forbidden in the future**. - - You are advised to store results of Geocoder API queries into your datasets and refresh them as needed, so that you can have finer control on your credits' usage. - -### cdb_geocode_street_point(_search_text text, [city text], [state text], [country text]_) - -#### Arguments - -Name | Type | Description ---- | --- | --- -`searchtext` | `text` | searchtext contains free-form text containing address elements. You can specify the searchtext parameter by itself, or you can specify it with other parameters to narrow your search. For example, you can specify the state or country parameters, along with a free-form address in the searchtext field. -`city` | `text` | (Optional) Name of the city -`state` | `text` | (Optional) Name of the state -`country` | `text` | (Optional) Name of the country - -#### Returns - -Geometry (point, EPSG 4326) or null - -#### Example - -##### Select - -```bash -SELECT cdb_geocode_street_point('651 Lombard Street, San Francisco, California, United States') -SELECT cdb_geocode_street_point('651 Lombard Street', 'San Francisco') -SELECT cdb_geocode_street_point('651 Lombard Street', 'San Francisco', 'California') -SELECT cdb_geocode_street_point('651 Lombard Street', 'San Francisco', 'California', 'United States') -``` - -##### Update - -```bash -UPDATE {tablename} SET the_geom = cdb_geocode_street_point({street_name_column}) -``` -# Routing functions - -The following rouging functions are available, grouped by categories. - -## Isolines - -This function provides an isolines generator sirves based on time or distance. - -### cdb_isodistance(_source geometry, mode text, range integer[], options text[]_) - -#### Arguments - -Name | Type | Description | Accepted values ---- | --- | --- | --- -`source` | `geometry` | Source point, in 4326 projection, taken as the start point -`mode` | `geometry` | Type of transport used to calculate the isolines. | `car` and `walk` -`range` | `integer[]` | Range of the isoline in meters -`options` | `text[]` | Multiple options to add more capabilities to the analysis. See the options section to know more. - -#### Options - -The options values must be pass in the following way: `option=value`. - -Name | Type | Description | Accepted values ---- | --- | --- | --- -`is_destination` | `boolean` | If is true the source point is the destination instead of the starting one. -`mode_type` | `text` | Type of route calculation | `shortest` or `fastest`. By default is `shortest` -`mode_traffic` | `text` | Use the traffic data to calculate the route. | `enabled` or `disabled`. By default is `disabled` -`singlecomponent` | `boolean` | If set to true the isoline service will always return single polygon, instead of creating a separate polygon for each ferry separated island. | `true` or `false`. Default value is false. -`resolution` | `text` | Allows to specify level of detail needed for the isoline polygon. Unit is meters per pixel. Higher resolution may cause increased response time from the service. -`maxpoints` | `text` | Allows to limit amount of points in the returned isoline. If isoline consists of multiple components, sum of points from all components is considered. Each component will have at least 2 points, so it is possible that more points than maxpoints value will be returned. This is in case when 2 * number of components is higher than maxpoints. Enlarging number of maxpoints may cause increased response time from the service. -`quality` | `text` | Allows to reduce the quality of the isoline in favor of the response time. | `1`, `2`, `3`. Default value is 1 and it is the best quality. - -#### Returns - -Name | Type | Description ---- | --- | --- -`center` | `geometry` | Source point, in 4326 projection, taken as the start point -`data_range` | `integer` | The range that belongs to the generated isoline. -`the_geom` | `geometry (multipolygon)` | Geometry of the generated isoline in 4326 projection. - -#### Example - -##### Select - -```bash -SELECT * FROM cdb_isodistance('POINT(-3.70568 40.42028)'::geometry, 'car', ARRAY[1000,2000]::integer[]); -SELECT * FROM cdb_isodistance('POINT(-3.70568 40.42028)'::geometry, 'walk', ARRAY[1000]::integer[], ARRAY['mode_traffic=enabled','quality=3']::text[]); -``` - -### cdb_isochrone(_source geometry, mode text, range integer[], options text[]_) - -This function uses the same parameters and info as the `cdb_isodistance` function with the difference that the range is measured in seconds instead of meters - -#### Example - -##### Select - -```bash -SELECT * FROM cdb_isochrone('POINT(-3.70568 40.42028)'::geometry, 'car', ARRAY[300,900,12000]::integer[]); -SELECT * FROM cdb_isochrone('POINT(-3.70568 40.42028)'::geometry, 'walk', ARRAY[300,900]::integer[], ARRAY['mode_traffic=enabled','quality=3']::text[]); -``` From 7b844d7773216fa14d32c20692f069a4e162085b Mon Sep 17 00:00:00 2001 From: Carla Date: Fri, 12 Feb 2016 15:23:28 +0100 Subject: [PATCH 06/30] Update API.md --- doc/API.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/API.md b/doc/API.md index 74ca2ef..4b4ffb1 100644 --- a/doc/API.md +++ b/doc/API.md @@ -1,4 +1,6 @@ -# Geocoder API +# Data Services API + +The CartoDB Data Services API offers a set of location based services that can be used programatically to empower your geospatial applications. The CartoDB Geocoder API allows you to match your data with geometries on your map. This geocoding service can be used programatically to geocode datasets via the CartoDB SQL API. It is fed from _Open Data_ and it serves geometries for countries, provinces, states, cities, postal codes, IP addresses and street addresses. @@ -6,4 +8,5 @@ The CartoDB Geocoder API allows you to match your data with geometries on your m * [Quickstart](quickstart.md) * [General concepts](general_concepts.md) -* [Reference](reference.md) +* [Geocoding functions](geocoding_functions.md) +* [Routing functions](routing_functions.md) From d23b74d3c191d137040f820946ebb6c33e0ddef4 Mon Sep 17 00:00:00 2001 From: Carla Date: Fri, 12 Feb 2016 15:26:46 +0100 Subject: [PATCH 07/30] Update routing_functions.md --- doc/routing_functions.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/routing_functions.md b/doc/routing_functions.md index 013e1ba..0eec118 100644 --- a/doc/routing_functions.md +++ b/doc/routing_functions.md @@ -1,11 +1,11 @@ # Routing functions -The following rouging functions are available, grouped by categories. +The following routing functions are available, grouped by categories. ## Isolines -This function provides an isolines generator sirves based on time or distance. +This function provides an isolines generator service based on time or distance. ### cdb_isodistance(_source geometry, mode text, range integer[], options text[]_) @@ -14,7 +14,7 @@ This function provides an isolines generator sirves based on time or distance. Name | Type | Description | Accepted values --- | --- | --- | --- `source` | `geometry` | Source point, in 4326 projection, taken as the start point -`mode` | `geometry` | Type of transport used to calculate the isolines. | `car` and `walk` +`mode` | `geometry` | Type of transport used to calculate the isolines. | `car` or `walk` `range` | `integer[]` | Range of the isoline in meters `options` | `text[]` | Multiple options to add more capabilities to the analysis. See the options section to know more. @@ -51,7 +51,7 @@ SELECT * FROM cdb_isodistance('POINT(-3.70568 40.42028)'::geometry, 'walk', ARRA ### cdb_isochrone(_source geometry, mode text, range integer[], options text[]_) -This function uses the same parameters and info as the `cdb_isodistance` function with the difference that the range is measured in seconds instead of meters +This function uses the same parameters and information as the `cdb_isodistance` function with the difference that the range is measured in seconds instead of meters. #### Example From 0da873fd6f3d0cac3c0dc1784f1aed5764316cb9 Mon Sep 17 00:00:00 2001 From: Carla Date: Fri, 12 Feb 2016 18:06:50 +0100 Subject: [PATCH 08/30] Update API.md --- doc/API.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/API.md b/doc/API.md index 4b4ffb1..6740b03 100644 --- a/doc/API.md +++ b/doc/API.md @@ -2,7 +2,9 @@ The CartoDB Data Services API offers a set of location based services that can be used programatically to empower your geospatial applications. -The CartoDB Geocoder API allows you to match your data with geometries on your map. This geocoding service can be used programatically to geocode datasets via the CartoDB SQL API. It is fed from _Open Data_ and it serves geometries for countries, provinces, states, cities, postal codes, IP addresses and street addresses. +The Geocoder functions allow you to match your data with geometries on your map. This geocoding service can be used programatically to geocode datasets via the CartoDB SQL API. It is fed from _Open Data_ and it serves geometries for countries, provinces, states, cities, postal codes, IP addresses and street addresses. + +The Routing functions --- ## Documentation From d8bc370ab1dd3f3e4d9bb1edf4eb80c3434397ff Mon Sep 17 00:00:00 2001 From: Carla Iriberri Date: Mon, 15 Feb 2016 11:42:00 +0100 Subject: [PATCH 09/30] Add content --- doc/API.md | 4 +-- doc/general_concepts.md | 14 ++++---- doc/quickstart.md | 9 +++-- doc/routing_functions.md | 77 +++++++++++++++++++++++++++------------- 4 files changed, 69 insertions(+), 35 deletions(-) diff --git a/doc/API.md b/doc/API.md index 6740b03..2a309c8 100644 --- a/doc/API.md +++ b/doc/API.md @@ -1,10 +1,10 @@ # Data Services API -The CartoDB Data Services API offers a set of location based services that can be used programatically to empower your geospatial applications. +The CartoDB Data Services API offers a set of location based services that can be used programatically to empower your geospatial applications. The Geocoder functions allow you to match your data with geometries on your map. This geocoding service can be used programatically to geocode datasets via the CartoDB SQL API. It is fed from _Open Data_ and it serves geometries for countries, provinces, states, cities, postal codes, IP addresses and street addresses. -The Routing functions --- +The Routing functions provide a way to generate isolines in terms of distance and time by means of the available isodistance and isochrone functions useful for Trade Areas Analysis. ## Documentation diff --git a/doc/general_concepts.md b/doc/general_concepts.md index 1287375..1d65c6e 100644 --- a/doc/general_concepts.md +++ b/doc/general_concepts.md @@ -1,20 +1,20 @@ # General concepts -The Geocoder API offers geocoding services on top of the CartoDB SQL API by means of a set of geocoding functions. Each one of these functions is oriented to one kind of geocoding operation and it will return the corresponding geometry (a `polygon` or a `point`) according to the input information. +The Data Services API offers geocoding and routing services on top of the CartoDB SQL API by means of a set of functions. Each one of these functions is oriented to one kind of operation and it will return the corresponding geometry (a `polygon` or a `point`) according to the input information. -The Geocoder API decouples the geocoding service from the CartoDB Editor, and allows to geocode data (being single rows, complete datasets or simple inputs) programatically through authenticated requests. +The Data Services API decouples the geocoding and routing services from the CartoDB Editor. The API allows to geocode data (being single rows, complete datasets or simple inputs) and to perform routing analysis (computing isodistances or isochrones) programatically through authenticated requests. The geometries provided by this API are projected in the projection [WGS 84 SRID 4326](http://spatialreference.org/ref/epsg/wgs-84/). -The Geocoder API can return different types of geometries (points or polygons) as result of different geocoding processes. The CartoDB platform does not support multigeometry layers or datasets, therefore the final users of this Geocoder API must check that they are using consistent geometry types inside a table to avoid further conflicts in the map visualization. +The Geocoder functions can return different types of geometries (points or polygons) as result of different geocoding processes. The CartoDB platform does not support multigeometry layers or datasets, therefore the final users of this Data Services API must check that they are using consistent geometry types inside a table to avoid further conflicts in the map visualization. ## Authentication -All requests performed to the CartoDB Geocoder API must be authenticated with the user API Key. For more information about where to find your API Key, and how to authenticate your SQL API requests, view the [SQL API authentication](/cartodb-platform/sql-api/authentication/) guide. +All requests performed to the CartoDB Data Services API must be authenticated with the user API Key. For more information about where to find your API Key, and how to authenticate your SQL API requests, view the [SQL API authentication](/cartodb-platform/sql-api/authentication/) guide. ## Errors -Errors are described in the response of the geocoder request. An example is as follows: +Errors are described in the response of the request. An example is as follows: ```json { @@ -24,10 +24,10 @@ Errors are described in the response of the geocoder request. An example is as f } ``` -Since the Geocoder API is used on top of the CartoDB SQL API, you can refer to the [Making calls to the SQL API](/cartodb-platform/sql-api/making-calls/) documentation for help debugging your SQL errors. +Since the Data Services API is used on top of the CartoDB SQL API, you can refer to the [Making calls to the SQL API](/cartodb-platform/sql-api/making-calls/) documentation for help debugging your SQL errors. If the requested information is not in the CartoDB geocoding database, or if CartoDB is unable to recognize your input and match it with a result, the geocoding function returns `null` as a result. ## Limits -Usage of the Geocoder API is subject to the CartoDB SQL API limits, stated in our [Terms of Service](https://cartodb.com/terms/#excessive). +Usage of the Data Services API is subject to the CartoDB SQL API limits, stated in our [Terms of Service](https://cartodb.com/terms/#excessive). diff --git a/doc/quickstart.md b/doc/quickstart.md index d9758ba..ccacabc 100644 --- a/doc/quickstart.md +++ b/doc/quickstart.md @@ -1,6 +1,6 @@ # Quickstart -If you are using the set of APIs and libraries that CartoDB offers, and you are handling your data with the SQL API, you can make your data visible in your maps by geocoding the dataset programatically. +If you are using the set of APIs and libraries that CartoDB offers, and you are handling your data with the SQL API, you can make your data visible in your maps by geocoding the dataset programatically. The set of Routing functions allow to calculate the area which can be reached by travelling a given distance or time, useful for geospatial analysis such as Trade Area Analysis. Here is an example of how to geocode a single country: @@ -13,8 +13,13 @@ In order to geocode an existent CartoDB dataset, an SQL UPDATE statement must be ```bash https://{username}.cartodb.com/api/v2/sql?q=UPDATE {tablename} SET the_geom = cdb_geocode_admin0_polygon({country_column})&api_key={Your API key} ``` +You can use the routing functions to retrieve, for example, isochrone lines from a certain location, specifying the mode and the ranges that will define each of the isolines. The following query calculates isolines for areas that are 5, 10 and 15 minutes (300, 600 and 900 seconds respectively) away of the location by following a path defined by car routing. -Notice that you can make use of Postgres or PostGIS functions in your Geocoder API requests, as the result of it will be a geometry that can be handled by the system. As an example, if you need to retrieve the centroid of a specific country, you can wrap the resulting geometry from the Geocoder API inside the PostGIS `ST_Centroid` function: +```bash +https://{username}.cartodb.com/api/v2/sql?q=SELECT cdb_isochrone('POINT(-3.70568 40.42028)'::geometry, 'car', ARRAY[300,600,900]::integer[])&api_key={Your API key} +``` + +Notice that you can make use of Postgres or PostGIS functions in your Data Services API requests, as the result of it will be a geometry that can be handled by the system. As an example, if you need to retrieve the centroid of a specific country, you can wrap the resulting geometry from the geocoder functions inside the PostGIS `ST_Centroid` function: ```bash https://{username}.cartodb.com/api/v2/sql?q=SELECT ST_Centroid(cdb_geocode_admin0_polygon('USA'))&api_key={Your API key} diff --git a/doc/routing_functions.md b/doc/routing_functions.md index 0eec118..68a16a3 100644 --- a/doc/routing_functions.md +++ b/doc/routing_functions.md @@ -1,7 +1,7 @@ # Routing functions -The following routing functions are available, grouped by categories. +The following routing functions are available. ## Isolines @@ -13,51 +13,80 @@ This function provides an isolines generator service based on time or distance. Name | Type | Description | Accepted values --- | --- | --- | --- -`source` | `geometry` | Source point, in 4326 projection, taken as the start point +`source` | `geometry` | Source point, in 4326 projection, which defines the start location. | `mode` | `geometry` | Type of transport used to calculate the isolines. | `car` or `walk` -`range` | `integer[]` | Range of the isoline in meters -`options` | `text[]` | Multiple options to add more capabilities to the analysis. See the options section to know more. +`range` | `integer[]` | Range of the isoline in meters. | +`options` | `text[]` | Optional. Multiple options to add more capabilities to the analysis. See the **Optional isolines parameters** section below for details. -#### Options - -The options values must be pass in the following way: `option=value`. - -Name | Type | Description | Accepted values ---- | --- | --- | --- -`is_destination` | `boolean` | If is true the source point is the destination instead of the starting one. -`mode_type` | `text` | Type of route calculation | `shortest` or `fastest`. By default is `shortest` -`mode_traffic` | `text` | Use the traffic data to calculate the route. | `enabled` or `disabled`. By default is `disabled` -`singlecomponent` | `boolean` | If set to true the isoline service will always return single polygon, instead of creating a separate polygon for each ferry separated island. | `true` or `false`. Default value is false. -`resolution` | `text` | Allows to specify level of detail needed for the isoline polygon. Unit is meters per pixel. Higher resolution may cause increased response time from the service. -`maxpoints` | `text` | Allows to limit amount of points in the returned isoline. If isoline consists of multiple components, sum of points from all components is considered. Each component will have at least 2 points, so it is possible that more points than maxpoints value will be returned. This is in case when 2 * number of components is higher than maxpoints. Enlarging number of maxpoints may cause increased response time from the service. -`quality` | `text` | Allows to reduce the quality of the isoline in favor of the response time. | `1`, `2`, `3`. Default value is 1 and it is the best quality. #### Returns Name | Type | Description --- | --- | --- -`center` | `geometry` | Source point, in 4326 projection, taken as the start point -`data_range` | `integer` | The range that belongs to the generated isoline. -`the_geom` | `geometry (multipolygon)` | Geometry of the generated isoline in 4326 projection. +`center` | `geometry` | Source point, in 4326 projection, which defines the start location. +`data_range` | `integer` | The range that belongs to the generated isoline. +`the_geom` | `geometry(MultiPolygon)` | MultiPolygon geometry of the generated isoline in the 4326 projection. -#### Example +#### Examples -##### Select +##### Select the results of the isodistance function ```bash SELECT * FROM cdb_isodistance('POINT(-3.70568 40.42028)'::geometry, 'car', ARRAY[1000,2000]::integer[]); +``` + +```bash SELECT * FROM cdb_isodistance('POINT(-3.70568 40.42028)'::geometry, 'walk', ARRAY[1000]::integer[], ARRAY['mode_traffic=enabled','quality=3']::text[]); ``` +##### Select the geometric results of the isodistance function + +```bash +SELECT the_geom FROM cdb_isodistance('POINT(-3.70568 40.42028)'::geometry, 'walk', ARRAY[1000]::integer[]); +``` + + ### cdb_isochrone(_source geometry, mode text, range integer[], options text[]_) +#### Arguments + This function uses the same parameters and information as the `cdb_isodistance` function with the difference that the range is measured in seconds instead of meters. -#### Example +Name | Type | Description | Accepted values +--- | --- | --- | --- +`source` | `geometry` | Source point, in 4326 projection, which defines the start location. | +`mode` | `geometry` | Type of transport used to calculate the isolines. | `car` or `walk` +`range` | `integer[]` | Range of the isoline in seconds. | +`options` | `text[]` | Optional. Multiple options to add more capabilities to the analysis. See the **Optional isolines parameters** section below for details. -##### Select +#### Examples + +##### Select the results of the isochrone function ```bash SELECT * FROM cdb_isochrone('POINT(-3.70568 40.42028)'::geometry, 'car', ARRAY[300,900,12000]::integer[]); +``` + +```bash SELECT * FROM cdb_isochrone('POINT(-3.70568 40.42028)'::geometry, 'walk', ARRAY[300,900]::integer[], ARRAY['mode_traffic=enabled','quality=3']::text[]); ``` + +##### Select the geometric results of the isochrone function + +```bash +SELECT the_geom FROM cdb_isochrone('POINT(-3.70568 40.42028)'::geometry, 'walk', ARRAY[300]::integer[]); +``` + +### Optional isoline parameters + +The optional value parameters must be passed with the format: `option=value`. + +Name | Type | Description | Accepted values +--- | --- | --- | --- +`is_destination` | `boolean` | If true, the source point is the destination instead of the starting location | `true` or `false` +`mode_type` | `text` | Type of route calculation | `shortest` or `fastest`. `shortest` by default +`mode_traffic` | `text` | Use traffic data to calculate the route | `enabled` or `disabled`. `disabled` by default +`singlecomponent` | `boolean` | If true, the isoline service will return a single polygon area, instead of creating a separate polygon for each reachable area separated of the main polygon (known as island). | `true` or `false`. `false` by default +`resolution` | `text` | Allows to specify level of detail needed for the isoline polygon. Unit is meters per pixel. Higher resolution may increase the response time of the service. +`maxpoints` | `text` | Allows to limit the amount of points in the returned isoline. If tge isoline consists of multiple components, the sum of points from all components is considered. Each component will have at least 2 points. It is possible that more points than specified could be returned in case when 2 * number of components` is higher than the `maxpoints` value itself. Increasing the number of `maxpoints` may increase the response time of the service. +`quality` | `text` | Allows to reduce the quality of the isoline in favor of the response time. | `1`, `2`, `3`. Default value is `1`, corresponding to the best quality option. From ecd387cc8f0b7176ea8f2fa262e8faf02619638a Mon Sep 17 00:00:00 2001 From: Carla Date: Mon, 15 Feb 2016 14:17:13 +0100 Subject: [PATCH 10/30] Update API.md --- doc/API.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/API.md b/doc/API.md index 2a309c8..d22ec4b 100644 --- a/doc/API.md +++ b/doc/API.md @@ -2,9 +2,9 @@ The CartoDB Data Services API offers a set of location based services that can be used programatically to empower your geospatial applications. -The Geocoder functions allow you to match your data with geometries on your map. This geocoding service can be used programatically to geocode datasets via the CartoDB SQL API. It is fed from _Open Data_ and it serves geometries for countries, provinces, states, cities, postal codes, IP addresses and street addresses. +The geocoder functions allow you to match your data with geometries on your map. This geocoding service can be used programatically to geocode datasets via the CartoDB SQL API. It is fed from _Open Data_ and it serves geometries for countries, provinces, states, cities, postal codes, IP addresses and street addresses. -The Routing functions provide a way to generate isolines in terms of distance and time by means of the available isodistance and isochrone functions useful for Trade Areas Analysis. +The isoline functions provide a way to generate isolines in terms of distance and time by means of the available isodistance and isochrone functions useful for Trade Areas Analysis. ## Documentation From dea64f9fe6679d7a9db98fe22fc21768f2d1e5bb Mon Sep 17 00:00:00 2001 From: Carla Date: Mon, 15 Feb 2016 14:17:47 +0100 Subject: [PATCH 11/30] Update general_concepts.md --- doc/general_concepts.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/general_concepts.md b/doc/general_concepts.md index 1d65c6e..3a318fa 100644 --- a/doc/general_concepts.md +++ b/doc/general_concepts.md @@ -2,7 +2,7 @@ The Data Services API offers geocoding and routing services on top of the CartoDB SQL API by means of a set of functions. Each one of these functions is oriented to one kind of operation and it will return the corresponding geometry (a `polygon` or a `point`) according to the input information. -The Data Services API decouples the geocoding and routing services from the CartoDB Editor. The API allows to geocode data (being single rows, complete datasets or simple inputs) and to perform routing analysis (computing isodistances or isochrones) programatically through authenticated requests. +The Data Services API decouples the geocoding and routing services from the CartoDB Editor. The API allows to geocode data (being single rows, complete datasets or simple inputs) and to perform trade areas analysis (computing isodistances or isochrones) programatically through authenticated requests. The geometries provided by this API are projected in the projection [WGS 84 SRID 4326](http://spatialreference.org/ref/epsg/wgs-84/). From c95aa171c7a45c8614e1d888f2943354d29df91d Mon Sep 17 00:00:00 2001 From: Carla Date: Mon, 15 Feb 2016 14:19:09 +0100 Subject: [PATCH 12/30] Update routing_functions.md --- 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 68a16a3..91b91bc 100644 --- a/doc/routing_functions.md +++ b/doc/routing_functions.md @@ -83,7 +83,7 @@ The optional value parameters must be passed with the format: `option=value`. Name | Type | Description | Accepted values --- | --- | --- | --- -`is_destination` | `boolean` | If true, the source point is the destination instead of the starting location | `true` or `false` +`is_destination` | `boolean` | If true, the source point is the destination instead of the starting location | `true` or `false`. `false` by default `mode_type` | `text` | Type of route calculation | `shortest` or `fastest`. `shortest` by default `mode_traffic` | `text` | Use traffic data to calculate the route | `enabled` or `disabled`. `disabled` by default `singlecomponent` | `boolean` | If true, the isoline service will return a single polygon area, instead of creating a separate polygon for each reachable area separated of the main polygon (known as island). | `true` or `false`. `false` by default From b5cdeedb361a5db8315ab914d4501ac1c1d7b476 Mon Sep 17 00:00:00 2001 From: csobier Date: Tue, 16 Feb 2016 08:26:37 -0500 Subject: [PATCH 13/30] applied minor grammar edits --- doc/API.md | 2 +- doc/general_concepts.md | 4 ++-- doc/quickstart.md | 6 +++--- doc/routing_functions.md | 18 +++++++++--------- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/doc/API.md b/doc/API.md index d22ec4b..7fa5273 100644 --- a/doc/API.md +++ b/doc/API.md @@ -4,7 +4,7 @@ The CartoDB Data Services API offers a set of location based services that can b The geocoder functions allow you to match your data with geometries on your map. This geocoding service can be used programatically to geocode datasets via the CartoDB SQL API. It is fed from _Open Data_ and it serves geometries for countries, provinces, states, cities, postal codes, IP addresses and street addresses. -The isoline functions provide a way to generate isolines in terms of distance and time by means of the available isodistance and isochrone functions useful for Trade Areas Analysis. +The isoline functions provide a way to generate isolines in terms of distance and time, by means of the available isodistance and isochrone functions useful for Trade Areas Analysis. ## Documentation diff --git a/doc/general_concepts.md b/doc/general_concepts.md index 3a318fa..d6cc2ca 100644 --- a/doc/general_concepts.md +++ b/doc/general_concepts.md @@ -1,8 +1,8 @@ # General concepts -The Data Services API offers geocoding and routing services on top of the CartoDB SQL API by means of a set of functions. Each one of these functions is oriented to one kind of operation and it will return the corresponding geometry (a `polygon` or a `point`) according to the input information. +The Data Services API offers geocoding and routing services on top of the CartoDB SQL API by means of a set of functions. Each one of these functions is oriented to one kind of operation and returns the corresponding geometry (a `polygon` or a `point`), according to the input information. -The Data Services API decouples the geocoding and routing services from the CartoDB Editor. The API allows to geocode data (being single rows, complete datasets or simple inputs) and to perform trade areas analysis (computing isodistances or isochrones) programatically through authenticated requests. +The Data Services API decouples the geocoding and routing services from the CartoDB Editor. The API allows you to geocode data (from single rows, complete datasets, or simple inputs) and to perform trade areas analysis (computing isodistances or isochrones) programatically through authenticated requests. The geometries provided by this API are projected in the projection [WGS 84 SRID 4326](http://spatialreference.org/ref/epsg/wgs-84/). diff --git a/doc/quickstart.md b/doc/quickstart.md index ccacabc..ec79bd8 100644 --- a/doc/quickstart.md +++ b/doc/quickstart.md @@ -1,6 +1,6 @@ # Quickstart -If you are using the set of APIs and libraries that CartoDB offers, and you are handling your data with the SQL API, you can make your data visible in your maps by geocoding the dataset programatically. The set of Routing functions allow to calculate the area which can be reached by travelling a given distance or time, useful for geospatial analysis such as Trade Area Analysis. +If you are using the set of APIs and libraries that CartoDB offers, and you are handling your data with the SQL API, you can make your data visible in your maps by geocoding the dataset programatically. The set of routing functions allow you to calculate the area which can be reached by travelling a given distance or time, useful for geospatial analysis, such as Trade Area Analysis. Here is an example of how to geocode a single country: @@ -13,13 +13,13 @@ In order to geocode an existent CartoDB dataset, an SQL UPDATE statement must be ```bash https://{username}.cartodb.com/api/v2/sql?q=UPDATE {tablename} SET the_geom = cdb_geocode_admin0_polygon({country_column})&api_key={Your API key} ``` -You can use the routing functions to retrieve, for example, isochrone lines from a certain location, specifying the mode and the ranges that will define each of the isolines. The following query calculates isolines for areas that are 5, 10 and 15 minutes (300, 600 and 900 seconds respectively) away of the location by following a path defined by car routing. +You can use the routing functions to retrieve. For example, retrieve isochrone lines from a certain location, specifying the mode and the ranges that will define each of the isolines. The following query calculates isolines for areas that are 5, 10 and 15 minutes (300, 600 and 900 seconds, respectively) away from the location by following a path defined by car routing. ```bash https://{username}.cartodb.com/api/v2/sql?q=SELECT cdb_isochrone('POINT(-3.70568 40.42028)'::geometry, 'car', ARRAY[300,600,900]::integer[])&api_key={Your API key} ``` -Notice that you can make use of Postgres or PostGIS functions in your Data Services API requests, as the result of it will be a geometry that can be handled by the system. As an example, if you need to retrieve the centroid of a specific country, you can wrap the resulting geometry from the geocoder functions inside the PostGIS `ST_Centroid` function: +Notice that you can make use of Postgres or PostGIS functions in your Data Services API requests, as the result is a geometry that can be handled by the system. For example, suppose you need to retrieve the centroid of a specific country, you can wrap the resulting geometry from the geocoder functions inside the PostGIS `ST_Centroid` function: ```bash https://{username}.cartodb.com/api/v2/sql?q=SELECT ST_Centroid(cdb_geocode_admin0_polygon('USA'))&api_key={Your API key} diff --git a/doc/routing_functions.md b/doc/routing_functions.md index 91b91bc..74c074f 100644 --- a/doc/routing_functions.md +++ b/doc/routing_functions.md @@ -15,8 +15,8 @@ Name | Type | Description | Accepted values --- | --- | --- | --- `source` | `geometry` | Source point, in 4326 projection, which defines the start location. | `mode` | `geometry` | Type of transport used to calculate the isolines. | `car` or `walk` -`range` | `integer[]` | Range of the isoline in meters. | -`options` | `text[]` | Optional. Multiple options to add more capabilities to the analysis. See the **Optional isolines parameters** section below for details. +`range` | `integer[]` | Range of the isoline, in meters. | +`options` | `text[]` | Optional. Multiple options to add more capabilities to the analysis. See [Optional isolines parameters](#optional-isoline-parameters) for details. #### Returns @@ -50,14 +50,14 @@ SELECT the_geom FROM cdb_isodistance('POINT(-3.70568 40.42028)'::geometry, 'walk #### Arguments -This function uses the same parameters and information as the `cdb_isodistance` function with the difference that the range is measured in seconds instead of meters. +This function uses the same parameters and information as the `cdb_isodistance` function, with the exception that the range is measured in seconds instead of meters. Name | Type | Description | Accepted values --- | --- | --- | --- `source` | `geometry` | Source point, in 4326 projection, which defines the start location. | `mode` | `geometry` | Type of transport used to calculate the isolines. | `car` or `walk` -`range` | `integer[]` | Range of the isoline in seconds. | -`options` | `text[]` | Optional. Multiple options to add more capabilities to the analysis. See the **Optional isolines parameters** section below for details. +`range` | `integer[]` | Range of the isoline, in seconds. | +`options` | `text[]` | Optional. Multiple options to add more capabilities to the analysis. See [Optional isolines parameters](#optional-isoline-parameters) for details. #### Examples @@ -79,7 +79,7 @@ SELECT the_geom FROM cdb_isochrone('POINT(-3.70568 40.42028)'::geometry, 'walk', ### Optional isoline parameters -The optional value parameters must be passed with the format: `option=value`. +The optional value parameters must be passed using the format: `option=value`. Name | Type | Description | Accepted values --- | --- | --- | --- @@ -87,6 +87,6 @@ Name | Type | Description | Accepted values `mode_type` | `text` | Type of route calculation | `shortest` or `fastest`. `shortest` by default `mode_traffic` | `text` | Use traffic data to calculate the route | `enabled` or `disabled`. `disabled` by default `singlecomponent` | `boolean` | If true, the isoline service will return a single polygon area, instead of creating a separate polygon for each reachable area separated of the main polygon (known as island). | `true` or `false`. `false` by default -`resolution` | `text` | Allows to specify level of detail needed for the isoline polygon. Unit is meters per pixel. Higher resolution may increase the response time of the service. -`maxpoints` | `text` | Allows to limit the amount of points in the returned isoline. If tge isoline consists of multiple components, the sum of points from all components is considered. Each component will have at least 2 points. It is possible that more points than specified could be returned in case when 2 * number of components` is higher than the `maxpoints` value itself. Increasing the number of `maxpoints` may increase the response time of the service. -`quality` | `text` | Allows to reduce the quality of the isoline in favor of the response time. | `1`, `2`, `3`. Default value is `1`, corresponding to the best quality option. +`resolution` | `text` | Allows you to specify the level of detail needed for the isoline polygon. Unit is meters per pixel. Higher resolution may increase the response time of the service. +`maxpoints` | `text` | Allows you to limit the amount of points in the returned isoline. If the isoline consists of multiple components, the sum of points from all components is considered. Each component will have at least two points. It is possible that more points than specified could be returned, in case when two * number of components` is higher than the `maxpoints` value itself. Increasing the number of `maxpoints` may increase the response time of the service. +`quality` | `text` | Allows you to reduce the quality of the isoline in favor of the response time. | `1`, `2`, `3`. Default value is `1`, corresponding to the best quality option. From 0bb046cc2167dc2b1d2cfb6b72e979efb8d4026a Mon Sep 17 00:00:00 2001 From: Carla Date: Wed, 17 Feb 2016 15:17:36 +0100 Subject: [PATCH 14/30] Remove routing naming --- doc/{routing_functions.md => isoline_functions.md} | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) rename doc/{routing_functions.md => isoline_functions.md} (96%) diff --git a/doc/routing_functions.md b/doc/isoline_functions.md similarity index 96% rename from doc/routing_functions.md rename to doc/isoline_functions.md index 74c074f..aab92ca 100644 --- a/doc/routing_functions.md +++ b/doc/isoline_functions.md @@ -1,11 +1,6 @@ +# Isoline functions -# Routing functions - -The following routing functions are available. - -## Isolines - -This function provides an isolines generator service based on time or distance. +The following functions provide an isolines generator service based on time or distance. ### cdb_isodistance(_source geometry, mode text, range integer[], options text[]_) From 3260c92ad25348bcbd3460636f5d4aae06cc3ab7 Mon Sep 17 00:00:00 2001 From: Carla Date: Wed, 17 Feb 2016 15:18:30 +0100 Subject: [PATCH 15/30] Remove routing naming --- doc/quickstart.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/quickstart.md b/doc/quickstart.md index ec79bd8..a567904 100644 --- a/doc/quickstart.md +++ b/doc/quickstart.md @@ -1,6 +1,6 @@ # Quickstart -If you are using the set of APIs and libraries that CartoDB offers, and you are handling your data with the SQL API, you can make your data visible in your maps by geocoding the dataset programatically. The set of routing functions allow you to calculate the area which can be reached by travelling a given distance or time, useful for geospatial analysis, such as Trade Area Analysis. +If you are using the set of APIs and libraries that CartoDB offers, and you are handling your data with the SQL API, you can make your data visible in your maps by geocoding the dataset programatically. The set of isoline functions allow you to calculate the area which can be reached by travelling a given distance or time, useful for geospatial analysis, such as Trade Area Analysis. Here is an example of how to geocode a single country: @@ -13,7 +13,7 @@ In order to geocode an existent CartoDB dataset, an SQL UPDATE statement must be ```bash https://{username}.cartodb.com/api/v2/sql?q=UPDATE {tablename} SET the_geom = cdb_geocode_admin0_polygon({country_column})&api_key={Your API key} ``` -You can use the routing functions to retrieve. For example, retrieve isochrone lines from a certain location, specifying the mode and the ranges that will define each of the isolines. The following query calculates isolines for areas that are 5, 10 and 15 minutes (300, 600 and 900 seconds, respectively) away from the location by following a path defined by car routing. +You can use the isoline functions to retrieve, for example, isochrone lines from a certain location, specifying the mode and the ranges that will define each of the isolines. The following query calculates isolines for areas that are 5, 10 and 15 minutes (300, 600 and 900 seconds, respectively) away from the location by following a path defined by car routing. ```bash https://{username}.cartodb.com/api/v2/sql?q=SELECT cdb_isochrone('POINT(-3.70568 40.42028)'::geometry, 'car', ARRAY[300,600,900]::integer[])&api_key={Your API key} From 9e6028872a099d585697ceb9199be42cdebc28b1 Mon Sep 17 00:00:00 2001 From: Carla Date: Wed, 17 Feb 2016 15:18:54 +0100 Subject: [PATCH 16/30] Remove routing naming --- doc/general_concepts.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/general_concepts.md b/doc/general_concepts.md index d6cc2ca..10f0a13 100644 --- a/doc/general_concepts.md +++ b/doc/general_concepts.md @@ -1,8 +1,8 @@ # General concepts -The Data Services API offers geocoding and routing services on top of the CartoDB SQL API by means of a set of functions. Each one of these functions is oriented to one kind of operation and returns the corresponding geometry (a `polygon` or a `point`), according to the input information. +The Data Services API offers geocoding and isoline services on top of the CartoDB SQL API by means of a set of functions. Each one of these functions is oriented to one kind of operation and returns the corresponding geometry (a `polygon` or a `point`), according to the input information. -The Data Services API decouples the geocoding and routing services from the CartoDB Editor. The API allows you to geocode data (from single rows, complete datasets, or simple inputs) and to perform trade areas analysis (computing isodistances or isochrones) programatically through authenticated requests. +The Data Services API decouples the geocoding and isoline services from the CartoDB Editor. The API allows you to geocode data (from single rows, complete datasets, or simple inputs) and to perform trade areas analysis (computing isodistances or isochrones) programatically through authenticated requests. The geometries provided by this API are projected in the projection [WGS 84 SRID 4326](http://spatialreference.org/ref/epsg/wgs-84/). From 4374f1108d97137462c361a9e4336fec3ebed30c Mon Sep 17 00:00:00 2001 From: Carla Date: Wed, 17 Feb 2016 15:19:21 +0100 Subject: [PATCH 17/30] Remove routing naming --- doc/API.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/API.md b/doc/API.md index 7fa5273..da60037 100644 --- a/doc/API.md +++ b/doc/API.md @@ -11,4 +11,4 @@ The isoline functions provide a way to generate isolines in terms of distance an * [Quickstart](quickstart.md) * [General concepts](general_concepts.md) * [Geocoding functions](geocoding_functions.md) -* [Routing functions](routing_functions.md) +* [Isoline functions](isoline_functions.md) From 5b5f9575d8c11d92e0c471e2396732c76ab3809a Mon Sep 17 00:00:00 2001 From: Carla Date: Wed, 17 Feb 2016 17:49:31 +0100 Subject: [PATCH 18/30] Update geocoding_functions.md --- doc/geocoding_functions.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/geocoding_functions.md b/doc/geocoding_functions.md index 503decf..8563430 100644 --- a/doc/geocoding_functions.md +++ b/doc/geocoding_functions.md @@ -275,9 +275,9 @@ This function provides a street-level geocoding service. This service uses the s Be mindful of the following when using this function: - - **One credit per function call will be consumed**, and the results are not cached. If the query applies to a N rows dataset, then N credits will be used. - - You are discouraged from using dynamic queries to the Geocoder API in your maps. This can result in credits consumption per map view. Note: **queries to the Geocoder API in your maps may be forbidden in the future**. - - You are advised to store results of Geocoder API queries into your datasets and refresh them as needed, so that you can have finer control on your credits' usage. + - **One credit per function call will be consumed**, and the results are not cached. If the query applies to a _N_ rows dataset, then _N_ credits will be used. + - You are discouraged from using dynamic queries to the geocoding functions in your maps. This can result in credits consumption per map view. Note: **queries to the Data Services API and its functions in your maps may be forbidden in the future**. + - You are advised to store results of geocoding queries into your datasets and refresh them as needed, so that you can have finer control on your credits' usage. ### cdb_geocode_street_point(_search_text text, [city text], [state text], [country text]_) From 03d50e96f4d9c200f12152c6956a57bcaad78bca Mon Sep 17 00:00:00 2001 From: Carla Date: Wed, 17 Feb 2016 17:49:33 +0100 Subject: [PATCH 19/30] Update isoline_functions.md --- doc/isoline_functions.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/isoline_functions.md b/doc/isoline_functions.md index aab92ca..439231d 100644 --- a/doc/isoline_functions.md +++ b/doc/isoline_functions.md @@ -1,6 +1,14 @@ # Isoline functions -The following functions provide an isolines generator service based on time or distance. +The following functions provide an isolines generator service based on time or distance. This service uses the isolines service defined for the user (currently, only the Here isolines service is available). + +This service is subject to quota limitations, and extra fees may apply. Please view our [terms and conditions](https://cartodb.com/terms/). + +Be mindful of the following when using this function: + +* One credit per function call will be consumed, and the results are not cached. If the query applies to a _N_ rows dataset, then _N_ credits will be used. +* You are discouraged from using dynamic queries to the isoline functions in your maps. This can result in credits consumption per map view. Note: queries to the Data Services API and any of its functions in your maps may be forbidden in the future. +* You are advised to store results of isoline queries into your datasets and refresh them as needed, so that you can have finer control on your credits' usage. ### cdb_isodistance(_source geometry, mode text, range integer[], options text[]_) From 610b9aef646d058cc074ca553d96bf2e6dc06caf Mon Sep 17 00:00:00 2001 From: Carla Date: Wed, 17 Feb 2016 17:49:50 +0100 Subject: [PATCH 20/30] Update isoline_functions.md --- doc/isoline_functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/isoline_functions.md b/doc/isoline_functions.md index 439231d..d0c96e7 100644 --- a/doc/isoline_functions.md +++ b/doc/isoline_functions.md @@ -4,7 +4,7 @@ The following functions provide an isolines generator service based on time or d This service is subject to quota limitations, and extra fees may apply. Please view our [terms and conditions](https://cartodb.com/terms/). -Be mindful of the following when using this function: +Be mindful of the following when using these functions: * One credit per function call will be consumed, and the results are not cached. If the query applies to a _N_ rows dataset, then _N_ credits will be used. * You are discouraged from using dynamic queries to the isoline functions in your maps. This can result in credits consumption per map view. Note: queries to the Data Services API and any of its functions in your maps may be forbidden in the future. From 134d2f400ef92b894a89ffad52a3ca49d141b5a2 Mon Sep 17 00:00:00 2001 From: Carla Date: Thu, 18 Feb 2016 09:42:50 +0100 Subject: [PATCH 21/30] Typo in function params --- doc/isoline_functions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/isoline_functions.md b/doc/isoline_functions.md index d0c96e7..3c20066 100644 --- a/doc/isoline_functions.md +++ b/doc/isoline_functions.md @@ -17,7 +17,7 @@ Be mindful of the following when using these functions: Name | Type | Description | Accepted values --- | --- | --- | --- `source` | `geometry` | Source point, in 4326 projection, which defines the start location. | -`mode` | `geometry` | Type of transport used to calculate the isolines. | `car` or `walk` +`mode` | `text` | Type of transport used to calculate the isolines. | `car` or `walk` `range` | `integer[]` | Range of the isoline, in meters. | `options` | `text[]` | Optional. Multiple options to add more capabilities to the analysis. See [Optional isolines parameters](#optional-isoline-parameters) for details. @@ -58,7 +58,7 @@ This function uses the same parameters and information as the `cdb_isodistance` Name | Type | Description | Accepted values --- | --- | --- | --- `source` | `geometry` | Source point, in 4326 projection, which defines the start location. | -`mode` | `geometry` | Type of transport used to calculate the isolines. | `car` or `walk` +`mode` | `text` | Type of transport used to calculate the isolines. | `car` or `walk` `range` | `integer[]` | Range of the isoline, in seconds. | `options` | `text[]` | Optional. Multiple options to add more capabilities to the analysis. See [Optional isolines parameters](#optional-isoline-parameters) for details. From 05179a4ef249cf2a68b27aff50565de058c17400 Mon Sep 17 00:00:00 2001 From: Carla Date: Fri, 19 Feb 2016 10:33:35 +0100 Subject: [PATCH 22/30] rm quota info, style optional params, rm islands --- doc/isoline_functions.md | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/doc/isoline_functions.md b/doc/isoline_functions.md index 3c20066..be760a6 100644 --- a/doc/isoline_functions.md +++ b/doc/isoline_functions.md @@ -2,15 +2,9 @@ The following functions provide an isolines generator service based on time or distance. This service uses the isolines service defined for the user (currently, only the Here isolines service is available). -This service is subject to quota limitations, and extra fees may apply. Please view our [terms and conditions](https://cartodb.com/terms/). +**This service is subject to quota limitations, and extra fees may apply**. Please view our [terms and conditions](https://cartodb.com/terms/) and check out the [Quota information section](http://docs.cartodb.com/cartodb-platform/dataservices-api/quota-information/) for details and recommendations related with quota usage. -Be mindful of the following when using these functions: - -* One credit per function call will be consumed, and the results are not cached. If the query applies to a _N_ rows dataset, then _N_ credits will be used. -* You are discouraged from using dynamic queries to the isoline functions in your maps. This can result in credits consumption per map view. Note: queries to the Data Services API and any of its functions in your maps may be forbidden in the future. -* You are advised to store results of isoline queries into your datasets and refresh them as needed, so that you can have finer control on your credits' usage. - -### cdb_isodistance(_source geometry, mode text, range integer[], options text[]_) +### cdb_isodistance(_source geometry, mode text, range integer[], [options text[]]_) #### Arguments @@ -19,7 +13,7 @@ Name | Type | Description | Accepted values `source` | `geometry` | Source point, in 4326 projection, which defines the start location. | `mode` | `text` | Type of transport used to calculate the isolines. | `car` or `walk` `range` | `integer[]` | Range of the isoline, in meters. | -`options` | `text[]` | Optional. Multiple options to add more capabilities to the analysis. See [Optional isolines parameters](#optional-isoline-parameters) for details. +`options` | `text[]` | (Optional) Multiple options to add more capabilities to the analysis. See [Optional isolines parameters](#optional-isoline-parameters) for details. #### Returns @@ -49,7 +43,7 @@ SELECT the_geom FROM cdb_isodistance('POINT(-3.70568 40.42028)'::geometry, 'walk ``` -### cdb_isochrone(_source geometry, mode text, range integer[], options text[]_) +### cdb_isochrone(_source geometry, mode text, range integer[], [options text[]]_) #### Arguments @@ -60,7 +54,7 @@ Name | Type | Description | Accepted values `source` | `geometry` | Source point, in 4326 projection, which defines the start location. | `mode` | `text` | Type of transport used to calculate the isolines. | `car` or `walk` `range` | `integer[]` | Range of the isoline, in seconds. | -`options` | `text[]` | Optional. Multiple options to add more capabilities to the analysis. See [Optional isolines parameters](#optional-isoline-parameters) for details. +`options` | `text[]` | (Optional) Multiple options to add more capabilities to the analysis. See [Optional isolines parameters](#optional-isoline-parameters) for details. #### Examples @@ -89,7 +83,6 @@ Name | Type | Description | Accepted values `is_destination` | `boolean` | If true, the source point is the destination instead of the starting location | `true` or `false`. `false` by default `mode_type` | `text` | Type of route calculation | `shortest` or `fastest`. `shortest` by default `mode_traffic` | `text` | Use traffic data to calculate the route | `enabled` or `disabled`. `disabled` by default -`singlecomponent` | `boolean` | If true, the isoline service will return a single polygon area, instead of creating a separate polygon for each reachable area separated of the main polygon (known as island). | `true` or `false`. `false` by default `resolution` | `text` | Allows you to specify the level of detail needed for the isoline polygon. Unit is meters per pixel. Higher resolution may increase the response time of the service. `maxpoints` | `text` | Allows you to limit the amount of points in the returned isoline. If the isoline consists of multiple components, the sum of points from all components is considered. Each component will have at least two points. It is possible that more points than specified could be returned, in case when two * number of components` is higher than the `maxpoints` value itself. Increasing the number of `maxpoints` may increase the response time of the service. `quality` | `text` | Allows you to reduce the quality of the isoline in favor of the response time. | `1`, `2`, `3`. Default value is `1`, corresponding to the best quality option. From 880cfd8742a9f650d6a082862366fd3c16f86c65 Mon Sep 17 00:00:00 2001 From: Carla Date: Fri, 19 Feb 2016 10:33:45 +0100 Subject: [PATCH 23/30] rm quota info --- doc/geocoding_functions.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/doc/geocoding_functions.md b/doc/geocoding_functions.md index 8563430..7794b32 100644 --- a/doc/geocoding_functions.md +++ b/doc/geocoding_functions.md @@ -271,13 +271,7 @@ UPDATE {tablename} SET the_geom = cdb_geocode_ipaddress_point('102.23.34.1') This function provides a street-level geocoding service. This service uses the street level geocoder defined for the user (currently, only the Here geocoder is available). -**This service is subject to quota limitations, and extra fees may apply.** Please view our [terms and conditions](https://cartodb.com/terms/) - -Be mindful of the following when using this function: - - - **One credit per function call will be consumed**, and the results are not cached. If the query applies to a _N_ rows dataset, then _N_ credits will be used. - - You are discouraged from using dynamic queries to the geocoding functions in your maps. This can result in credits consumption per map view. Note: **queries to the Data Services API and its functions in your maps may be forbidden in the future**. - - You are advised to store results of geocoding queries into your datasets and refresh them as needed, so that you can have finer control on your credits' usage. +**This service is subject to quota limitations, and extra fees may apply**. Please view our [terms and conditions](https://cartodb.com/terms/) and check out the [Quota information section](http://docs.cartodb.com/cartodb-platform/dataservices-api/quota-information/) for details and recommendations related with quota usage. ### cdb_geocode_street_point(_search_text text, [city text], [state text], [country text]_) From fa16d3fddf39f736e231563fa24b7b02c144af0b Mon Sep 17 00:00:00 2001 From: Carla Date: Fri, 19 Feb 2016 10:35:04 +0100 Subject: [PATCH 24/30] add section for quota info + recommendations --- doc/quota-information.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 doc/quota-information.md diff --git a/doc/quota-information.md b/doc/quota-information.md new file mode 100644 index 0000000..d0afb13 --- /dev/null +++ b/doc/quota-information.md @@ -0,0 +1,17 @@ +# Quota information + +This Data Services API provides functions which are subject to quota limitations, and extra fees may apply. Please check our [terms and conditions](https://cartodb.com/terms/) for detailed information about quotas. + +The functions that require are as follows: + +* cdb_geocode_street_point(_search_text text, [city text], [state text], [country text]_); from [Geocoding functions](http://docs.cartodb.com/cartodb-platform/dataservices-api/geocoding-functions/) +* cdb_isodistance(_source geometry, mode text, range integer[], [options text[]]_); from [Isoline functions](http://docs.cartodb.com/cartodb-platform/dataservices-api/isoline-functions/) +* cdb_isochrone(_source geometry, mode text, range integer[], [options text[]]_); from [Isoline functions](http://docs.cartodb.com/cartodb-platform/dataservices-api/isoline-functions/) + +## Quota consumption information and usage recommendations + +Be mindful of the following when using the abovementioned functions: + +* One credit per function call will be consumed, and the results are not cached. If the query is applied to a _N_ rows dataset, then _N_ credits will be used. +* You are discouraged from using dynamic queries to these functions in your maps. This can result in credits consumption per map view. **Note:** Queries to the Data Services API and any of its functions in your maps may be forbidden in the future. +* You are advised to store results of these queries into your datasets and refresh them as needed, so that you can have finer control on your credits' usage. From 23780b3f3a6b4a69478676c76af8fe5625558f0b Mon Sep 17 00:00:00 2001 From: Carla Date: Fri, 19 Feb 2016 11:15:35 +0100 Subject: [PATCH 25/30] rename --- doc/{quota-information.md => quota_information.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename doc/{quota-information.md => quota_information.md} (100%) diff --git a/doc/quota-information.md b/doc/quota_information.md similarity index 100% rename from doc/quota-information.md rename to doc/quota_information.md From 31711851c4fb9ec87aac00e5b0a1f5c61dbef17e Mon Sep 17 00:00:00 2001 From: Carla Date: Fri, 19 Feb 2016 13:05:14 +0100 Subject: [PATCH 26/30] Update quota_information.md --- doc/quota_information.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/quota_information.md b/doc/quota_information.md index d0afb13..8fa7328 100644 --- a/doc/quota_information.md +++ b/doc/quota_information.md @@ -2,7 +2,7 @@ This Data Services API provides functions which are subject to quota limitations, and extra fees may apply. Please check our [terms and conditions](https://cartodb.com/terms/) for detailed information about quotas. -The functions that require are as follows: +The functions that require service credits to be used are as follows: * cdb_geocode_street_point(_search_text text, [city text], [state text], [country text]_); from [Geocoding functions](http://docs.cartodb.com/cartodb-platform/dataservices-api/geocoding-functions/) * cdb_isodistance(_source geometry, mode text, range integer[], [options text[]]_); from [Isoline functions](http://docs.cartodb.com/cartodb-platform/dataservices-api/isoline-functions/) From d0bf339250ad441a064d4bd33817466f71b0d38b Mon Sep 17 00:00:00 2001 From: Carla Date: Fri, 19 Feb 2016 13:23:33 +0100 Subject: [PATCH 27/30] Update quota_information.md --- doc/quota_information.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/quota_information.md b/doc/quota_information.md index 8fa7328..d3cfaba 100644 --- a/doc/quota_information.md +++ b/doc/quota_information.md @@ -1,6 +1,6 @@ # Quota information -This Data Services API provides functions which are subject to quota limitations, and extra fees may apply. Please check our [terms and conditions](https://cartodb.com/terms/) for detailed information about quotas. +**This Data Services API provides functions which are subject to quota limitations, and extra fees may apply**. Please check our [terms and conditions](https://cartodb.com/terms/). The functions that require service credits to be used are as follows: From 2090ed56bc992539de770e2cba8cd70bc9edc60d Mon Sep 17 00:00:00 2001 From: Carla Date: Mon, 22 Feb 2016 17:18:15 +0100 Subject: [PATCH 28/30] Fix incorrect quoting --- doc/isoline_functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/isoline_functions.md b/doc/isoline_functions.md index be760a6..dfb1b74 100644 --- a/doc/isoline_functions.md +++ b/doc/isoline_functions.md @@ -84,5 +84,5 @@ Name | Type | Description | Accepted values `mode_type` | `text` | Type of route calculation | `shortest` or `fastest`. `shortest` by default `mode_traffic` | `text` | Use traffic data to calculate the route | `enabled` or `disabled`. `disabled` by default `resolution` | `text` | Allows you to specify the level of detail needed for the isoline polygon. Unit is meters per pixel. Higher resolution may increase the response time of the service. -`maxpoints` | `text` | Allows you to limit the amount of points in the returned isoline. If the isoline consists of multiple components, the sum of points from all components is considered. Each component will have at least two points. It is possible that more points than specified could be returned, in case when two * number of components` is higher than the `maxpoints` value itself. Increasing the number of `maxpoints` may increase the response time of the service. +`maxpoints` | `text` | Allows you to limit the amount of points in the returned isoline. If the isoline consists of multiple components, the sum of points from all components is considered. Each component will have at least two points. It is possible that more points than specified could be returned, in case when `2 * number of components` is higher than the `maxpoints` value itself. Increasing the number of `maxpoints` may increase the response time of the service. `quality` | `text` | Allows you to reduce the quality of the isoline in favor of the response time. | `1`, `2`, `3`. Default value is `1`, corresponding to the best quality option. From 3ba70358d5b60ae701a6d72a134a6892df5d9fd3 Mon Sep 17 00:00:00 2001 From: Mario de Frutos Date: Mon, 14 Mar 2016 17:42:46 +0100 Subject: [PATCH 29/30] Add more examples for the isolines functions --- doc/isoline_functions.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/doc/isoline_functions.md b/doc/isoline_functions.md index dfb1b74..ff52c7c 100644 --- a/doc/isoline_functions.md +++ b/doc/isoline_functions.md @@ -40,7 +40,11 @@ SELECT * FROM cdb_isodistance('POINT(-3.70568 40.42028)'::geometry, 'walk', ARRA ```bash SELECT the_geom FROM cdb_isodistance('POINT(-3.70568 40.42028)'::geometry, 'walk', ARRAY[1000]::integer[]); -``` + +##### Calculate and insert the generated points from the `points_table` table to another table where they're going to be stored + +```bash +INSERT INTO {table} (the_geom) SELECT (cdb_isodistance(the_geom, 'walk', string_to_array(distance, ',')::integer[])).the_geom FROM {points_table} ### cdb_isochrone(_source geometry, mode text, range integer[], [options text[]]_) @@ -72,7 +76,13 @@ SELECT * FROM cdb_isochrone('POINT(-3.70568 40.42028)'::geometry, 'walk', ARRAY[ ```bash SELECT the_geom FROM cdb_isochrone('POINT(-3.70568 40.42028)'::geometry, 'walk', ARRAY[300]::integer[]); -``` + + +##### Calculate and insert the generated points from the `points_table` table to another table where they're going to be stored + +```bash +INSERT INTO {table} (the_geom) SELECT (cdb_isochrone(the_geom, 'walk', string_to_array(time_distance, ',')::integer[])).the_geom FROM {points_table} + ### Optional isoline parameters From 1bdf2e80e686d14c496e8869ef3db240ca06d112 Mon Sep 17 00:00:00 2001 From: Mario de Frutos Date: Tue, 15 Mar 2016 08:00:22 +0100 Subject: [PATCH 30/30] Change the explanation --- doc/isoline_functions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/isoline_functions.md b/doc/isoline_functions.md index ff52c7c..fb23f90 100644 --- a/doc/isoline_functions.md +++ b/doc/isoline_functions.md @@ -41,7 +41,7 @@ SELECT * FROM cdb_isodistance('POINT(-3.70568 40.42028)'::geometry, 'walk', ARRA ```bash SELECT the_geom FROM cdb_isodistance('POINT(-3.70568 40.42028)'::geometry, 'walk', ARRAY[1000]::integer[]); -##### Calculate and insert the generated points from the `points_table` table to another table where they're going to be stored +##### Calculate and insert the generated isolines from `points_table` table to another table ```bash INSERT INTO {table} (the_geom) SELECT (cdb_isodistance(the_geom, 'walk', string_to_array(distance, ',')::integer[])).the_geom FROM {points_table} @@ -78,7 +78,7 @@ SELECT * FROM cdb_isochrone('POINT(-3.70568 40.42028)'::geometry, 'walk', ARRAY[ SELECT the_geom FROM cdb_isochrone('POINT(-3.70568 40.42028)'::geometry, 'walk', ARRAY[300]::integer[]); -##### Calculate and insert the generated points from the `points_table` table to another table where they're going to be stored +##### Calculate and insert the generated isolines from `points_table` table to another table ```bash INSERT INTO {table} (the_geom) SELECT (cdb_isochrone(the_geom, 'walk', string_to_array(time_distance, ',')::integer[])).the_geom FROM {points_table}