diff --git a/doc/API.md b/doc/API.md deleted file mode 100644 index 816c561..0000000 --- a/doc/API.md +++ /dev/null @@ -1,13 +0,0 @@ -# Data Services API - -The CARTO Data Services API offers a set of location based services that can be used programatically to empower your geospatial applications. - -## Documentation - -* [Overview](overview.md) -* [Geocoding Functions](geocoding_functions.md) -* [Isoline Functions](isoline_functions.md) -* [Routing Functions](routing_functions.md) -* [Demographic Functions](demographic_functions.md) -* [Segmentation Functions](segmentation_functions.md) -* [Quota Information](quota_information.md) \ No newline at end of file diff --git a/doc/overview.md b/docs/developer-center/guides/01-overview.md similarity index 73% rename from doc/overview.md rename to docs/developer-center/guides/01-overview.md index f37c1a8..fbb1901 100644 --- a/doc/overview.md +++ b/docs/developer-center/guides/01-overview.md @@ -1,12 +1,12 @@ -# Overview +## Overview By using CARTO libraries and the SQL API, you can apply location data services to your maps with unique data services functions. These functions are integrated with a number of internal and external services, enabling you to programatically customize subsets of data for your visualizations. These features are useful for geospatial analysis and the results can be saved, and stored, for additional location data service operations. -**Note:** Based on your account plan, some of these data services are subject to different [quota limitations](https://carto.com/docs/carto-engine/dataservices-api/quota-information/#quota-information). +**Note:** Based on your account plan, some of these data services are subject to different [quota limitations]({{site.dataservicesapi_docs}}/support/quota-information/). _In order to supply the best location data services from within our CARTO Engine, the Data Services API collaborates with [Mapbox](https://www.mapbox.com/) and several other geospatial service providers. [Contact us](mailto:sales@carto.com) if you have any specific questions or requirements about the location data service provider being used with your account._ -## Data Services Integration +### Data Services Integration By using the SQL API to query the Data Services API functions, you can manage specific operations and the corresponding geometries (a `polygon` or a `point`), according to the input information. @@ -14,21 +14,21 @@ The Data Services API also exposes its services directly through CARTO Builder. The geometries provided by this API are projected in the projection [WGS 84 SRID 4326](http://spatialreference.org/ref/epsg/wgs-84/). -**Note:** The Data Services API [geocoding functions](https://carto.com/docs/carto-engine/dataservices-api/geocoding-functions/#geocoding-functions) return different types of geometries (points or polygons) as result of different geocoding processes. The CARTO Engine does not support multi-geometry layers or datasets, therefore you must confirm that you are using consistent geometry types inside a table, to avoid future conflicts in your map visualization. +**Note:** The Data Services API [geocoding functions]({{site.dataservicesapi_docs}}/reference/#geocoding-functions) return different types of geometries (points or polygons) as result of different geocoding processes. The CARTO Engine does not support multi-geometry layers or datasets, therefore you must verify that you are using consistent geometry types inside a table, to avoid future conflicts in your map visualization. -### Best Practices +#### Best Practices _Be mindful of the following usage notes when using the Data Services functions with the SQL API:_ -It is discouraged to use the SELECT operation with the Data Services API functions in your map layers, as these type of queries consume quota when rendering tiles for your live map views. It may also result in sync performance issues, due to executing multiple requests to the API each time your map is viewed. See details about [Quota Consumption](https://carto.com/docs/carto-engine/dataservices-api/quota-information/#quota-consumption). +It is discouraged to use the SELECT operation with the Data Services API functions in your map layers, as these type of queries consume quota when rendering tiles for your live map views. It may also result in sync performance issues, due to executing multiple requests to the API each time your map is viewed. See details about [Quota Consumption]({{site.dataservicesapi_docs}}/support/quota-information/#quota-consumption). The Data Services API is **recommended** to be used with INSERT or UPDATE operations, for applying location data to your tables. While SELECT (retrieve) is standard for SQL API requests, be mindful of quota consumption and use INSERT (to insert a new record) or UPDATE (to update an existing record), for best practices. -## Authentication +### Authentication -All requests performed to the CARTO 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](/carto-engine/sql-api/authentication/) documentation. +All requests performed to the CARTO 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 [Auth API]({{site.authapi_docs}}/) documentation. -## Errors +### Errors Errors are described in the response of the request. An example is as follows: @@ -40,10 +40,10 @@ Errors are described in the response of the request. An example is as follows: } ``` -Since the Data Services API is used on top of the CARTO SQL API, you can refer to the [Making calls to the SQL API](https://carto.com/docs/carto-engine/sql-api/making-calls/) documentation for help debugging your SQL errors. +Since the Data Services API is used on top of the CARTO SQL API, you can refer to the [Making calls to the SQL API]({{site.sqlapi_docs}}/guides/making-calls/) documentation for help debugging your SQL errors. If the requested information is not in the CARTO geocoding database, or if CARTO is unable to recognize your input and match it with a result, the geocoding function returns `null` as a result. -## Limits +### Limits Usage of the Data Services API is subject to the CARTO SQL API limits, stated in our [Terms of Service](https://carto.com/terms/#excessive). diff --git a/docs/developer-center/img/avatar.gif b/docs/developer-center/img/avatar.gif new file mode 100644 index 0000000..586a34d Binary files /dev/null and b/docs/developer-center/img/avatar.gif differ diff --git a/docs/developer-center/reference/01-introduction.md b/docs/developer-center/reference/01-introduction.md new file mode 100644 index 0000000..f86c955 --- /dev/null +++ b/docs/developer-center/reference/01-introduction.md @@ -0,0 +1,5 @@ +## Introduction + +The CARTO Data Services API offers a set of location based services that can be used to programatically customize subsets of data for your visualizations. + +The contents described in this document are subject to CARTO's [Terms of Service](https://carto.com/legal/) diff --git a/docs/developer-center/reference/02-authentication.md b/docs/developer-center/reference/02-authentication.md new file mode 100644 index 0000000..4bb869f --- /dev/null +++ b/docs/developer-center/reference/02-authentication.md @@ -0,0 +1,9 @@ +## Authentication + +Data Services API, like any other [CARTO platform's component]({{site.fundamental_docs}}/components/), requires using an API Key. From your CARTO dashboard, click _[Your API keys](https://carto.com/login)_ from the avatar drop-down menu to view your uniquely generated API Key for managing data with CARTO Engine. + + + +Learn more about the [basics of authorization]({{site.fundamental_docs}}/authorization/), or dig into the details of [Auth API]({{site.authapi_docs}}/), if you want to know more about this part of CARTO platform. + +The examples in this documentation may include a placeholder for the API Key. Ensure that you modify any placeholder parameters with your own credentials. diff --git a/docs/developer-center/reference/03-versioning.md b/docs/developer-center/reference/03-versioning.md new file mode 100644 index 0000000..80d2a59 --- /dev/null +++ b/docs/developer-center/reference/03-versioning.md @@ -0,0 +1,3 @@ +## Versioning + +Data Services API uses [Semantic Versioning](http://semver.org/). View our Github repository to find tags for each [release](https://github.com/CartoDB/data-services-api/releases). diff --git a/docs/developer-center/reference/04-error-handling.md b/docs/developer-center/reference/04-error-handling.md new file mode 100644 index 0000000..aef0671 --- /dev/null +++ b/docs/developer-center/reference/04-error-handling.md @@ -0,0 +1,5 @@ +## Error handling + +Most of the errors fired by the API are handled by the API itself. It triggers a `CartoError` every time an error happens. + +A cartoError is an object containing a single `message` field with a string explaining the error. diff --git a/doc/geocoding_functions.md b/docs/developer-center/reference/05-geocoding-functions.md similarity index 74% rename from doc/geocoding_functions.md rename to docs/developer-center/reference/05-geocoding-functions.md index c5d2c21..4143f7f 100644 --- a/doc/geocoding_functions.md +++ b/docs/developer-center/reference/05-geocoding-functions.md @@ -1,8 +1,8 @@ -# Geocoding Functions +## Geocoding Functions The [geocoder](https://carto.com/data/geocoder-api/) functions allow you to match your data with geometries on your map. This geocoding service can be used programatically to geocode datasets via the CARTO SQL API. It is fed from _Open Data_ and it serves geometries for countries, provinces, states, cities, postal codes, IP addresses and street addresses. CARTO provides functions for several different categories of geocoding through the Data Services API. -_**This service is subject to quota limitations and extra fees may apply**. View the [Quota Information](https://carto.com/docs/carto-engine/dataservices-api/quota-information/) section for details and recommendations about to quota consumption._ +**Warning:** This service is subject to quota limitations and extra fees may apply. View the [Quota Information]({{site.dataservicesapi_docs}}/support/quota-information/) section for details and recommendations about to quota consumption. The following example displays how to geocode a single country: @@ -25,169 +25,168 @@ https://{username}.carto.com/api/v2/sql?q=UPDATE {tablename} SET the_geom = ST_C The following geocoding functions are available, grouped by categories. -## Country Geocoder +### Country Geocoder This function geocodes your data into country border geometries. It recognizes the names of the different countries either by different synonyms (such as their English name or their endonym), or by ISO (ISO2 or ISO3) codes. -### cdb_geocode_admin0_polygon(_country_name text_) +#### cdb_geocode_admin0_polygon(_country_name text_) Geocodes the text name of a country into a country_name geometry, displayed as polygon data. -#### Arguments +##### Arguments Name | Type | Description --- | --- | --- `country_name` | `text` | Name of the country -#### Returns +##### Returns Geometry (polygon, EPSG 4326) or null -#### Example +### Example -##### Update the geometry of a table to geocode it +#### Update the geometry of a table to geocode it ```bash UPDATE {tablename} SET the_geom = cdb_geocode_admin0_polygon({country_column}) ``` -##### Insert a geocoded row into a table - +#### Insert a geocoded row into a table ```bash INSERT INTO {tablename} (the_geom) SELECT cdb_geocode_admin0_polygon('France') ``` -## Level-1 Administrative Regions Geocoder +### Level-1 Administrative Regions Geocoder This function geocodes your data into polygon geometries for [Level 1](https://en.wikipedia.org/wiki/Table_of_administrative_divisions_by_country), or [NUTS-1](https://en.wikipedia.org/wiki/NUTS_1_statistical_regions_of_England), administrative divisions (or units) of countries. For example, a "state" in the United States, "départements" in France, or an autonomous community in Spain. -### cdb_geocode_admin1_polygon(_admin1_name text_) +#### cdb_geocode_admin1_polygon(_admin1_name text_) Geocodes the name of the province/state into a Level-1 administrative region, displayed as a polygon geometry. -#### Arguments +##### Arguments Name | Type | Description --- | --- | --- `admin1_name` | `text` | Name of the province/state -#### Returns +##### Returns Geometry (polygon, EPSG 4326) or null -#### Example +##### Example -##### Update the geometry of a table to geocode it +###### Update the geometry of a table to geocode it ```bash UPDATE {tablename} SET the_geom = cdb_geocode_admin1_polygon({province_column}) ``` -##### Insert a geocoded row into a table +###### Insert a geocoded row into a table ```bash INSERT INTO {tablename} (the_geom) SELECT cdb_geocode_admin1_polygon('Alicante') ``` -### cdb_geocode_admin1_polygon(_admin1_name text, country_name text_) +#### cdb_geocode_admin1_polygon(_admin1_name text, country_name text_) Geocodes the name of the province/state for a specified country into a Level-1 administrative region, displayed as a polygon geometry. -#### Arguments +##### 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 +##### Returns Geometry (polygon, EPSG 4326) or null -#### Example +##### Example -##### Update the geometry of a table to geocode it +###### Update the geometry of a table to geocode it ```bash UPDATE {tablename} SET the_geom = cdb_geocode_admin1_polygon({province_column}, {country_column}) ``` -##### Insert a geocoded row into a table +###### Insert a geocoded row into a table ```bash INSERT INTO {tablename} (the_geom) SELECT cdb_geocode_admin1_polygon('Alicante', 'Spain') ``` -## City Geocoder +### City Geocoder This function geocodes your data into point geometries for names of cities. It is recommended to use geocoding functions that require more defined parameters — this returns more accurate results when several cities have the same name. _If there are duplicate results for a city name, the city name with the highest population will be returned._ -### cdb_geocode_namedplace_point(_city_name text_) +#### cdb_geocode_namedplace_point(_city_name text_) Geocodes the text name of a city into a named place geometry, displayed as point data. -#### Arguments +##### Arguments Name | Type | Description --- | --- | --- `city_name` | `text` | Name of the city -#### Returns +##### Returns Geometry (point, EPSG 4326) or null -#### Example +##### Example -##### Select +###### Select -##### Update the geometry of a table to geocode it +###### Update the geometry of a table to geocode it ```bash UPDATE {tablename} SET the_geom = cdb_geocode_namedplace_point({city_column}) ``` -##### Insert a geocoded row into a table +###### Insert a geocoded row into a table ```bash INSERT INTO {tablename} (the_geom) SELECT cdb_geocode_namedplace_point('Barcelona') ``` -### cdb_geocode_namedplace_point(_city_name text, country_name text_) +#### cdb_geocode_namedplace_point(_city_name text, country_name text_) Geocodes the text name of a city for a specified country into a named place point geometry. -#### Arguments +##### 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 +##### Returns Geometry (point, EPSG 4326) or null -#### Example +##### Example -##### Update the geometry of a table to geocode it +###### Update the geometry of a table to geocode it ```bash UPDATE {tablename} SET the_geom = cdb_geocode_namedplace_point({city_column}, 'Spain') ``` -##### Insert a geocoded row into a table +###### Insert a geocoded row into a table ```bash INSERT INTO {tablename} (the_geom) SELECT cdb_geocode_namedplace_point('Barcelona', 'Spain') ``` -### cdb_geocode_namedplace_point(_city_name text, admin1_name text, country_name text_) +#### cdb_geocode_namedplace_point(_city_name text, admin1_name text, country_name text_) Geocodes your data into a named place point geometry, containing the text name of a city, for a specified province/state and country. This is recommended for the most accurate geocoding of city data. -#### Arguments +##### Arguments Name | Type | Description --- | --- | --- @@ -195,132 +194,132 @@ Name | Type | Description `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 +##### Returns Geometry (point, EPSG 4326) or null -#### Example +##### Example -##### Update the geometry of a table to geocode it +###### Update the geometry of a table to geocode it ```bash UPDATE {tablename} SET the_geom = cdb_geocode_namedplace_point({city_column}, {province_column}, 'USA') ``` -##### Insert a geocoded row into a table +###### Insert a geocoded row into a table ```bash INSERT INTO {tablename} (the_geom) SELECT cdb_geocode_namedplace_point('New York', 'New York', 'USA') ``` -## Postal Code Geocoder +### Postal Code Geocoder These functions geocode your data into point, or polygon, geometries for postal codes. The postal code geocoder covers the United States, France, Australia and Canada; a request for a different country will return an empty response. **Note:** For the USA, US Census Zip Code Tabulation Areas (ZCTA) are used to reference geocodes for USPS postal codes service areas. This is not a CARTO restriction, this is a US Government licensing protection of their zip code data source; which is not publicly available. Additionally, zip codes are considered service areas and are not actually geometric areas. As a solution, the US Census provides ZCTA data, which tabulates GIS postal codes for USPS locations by aggregating census blocks. For details about how ZCTAs are created, see [ZIP Code™ Tabulation Areas (ZCTAs™)](https://www.census.gov/geo/reference/zctas.html). If you are geocoding data and your zip codes fail, ensure you are using ZCTAs for the postal code. -### cdb_geocode_postalcode_polygon(_postal_code text, country_name text_) +#### cdb_geocode_postalcode_polygon(_postal_code text, country_name text_) Geocodes the postal code for a specified country into a **polygon** geometry. -#### Arguments +##### Arguments Name | Type | Description --- | --- | --- `postal_code` | `text` | Postal code `country_name` | `text` | Name of the country in which the postal code is located -#### Returns +##### Returns Geometry (polygon, EPSG 4326) or null -#### Example +##### Example -##### Update the geometry of a table to geocode it +###### Update the geometry of a table to geocode it ```bash UPDATE {tablename} SET the_geom = cdb_geocode_postalcode_polygon({postal_code_column}, 'USA') ``` -##### Insert a geocoded row into a table +###### Insert a geocoded row into a table ```bash INSERT INTO {tablename} (the_geom) SELECT cdb_geocode_postalcode_polygon('11211', 'USA') ``` -### cdb_geocode_postalcode_point(_code text, country_name text_) +#### cdb_geocode_postalcode_point(_code text, country_name text_) Geocodes the postal code for a specified country into a **point** geometry. -#### Arguments +##### Arguments Name | Type | Description --- | --- | --- `postal_code` | `text` | Postal code `country_name` | `text` | Name of the country in which the postal code is located -#### Returns +##### Returns Geometry (point, EPSG 4326) or null -#### Example +##### Example -##### Update the geometry of a table to geocode it +###### Update the geometry of a table to geocode it ```bash UPDATE {tablename} SET the_geom = cdb_geocode_postalcode_point({postal_code_column}, 'USA') ``` -##### Insert a geocoded row into a table +###### Insert a geocoded row into a table ```bash INSERT INTO {tablename} (the_geom) SELECT cdb_geocode_postalcode_point('11211', 'USA') ``` -## IP Addresses Geocoder +### IP Addresses Geocoder This function geocodes your data into point geometries for IP addresses. This is useful if you are analyzing location based data, based on a set of user's IP addresses. -### cdb_geocode_ipaddress_point(_ip_address text_) +#### cdb_geocode_ipaddress_point(_ip_address text_) Geocodes a postal code from a specified country into an IP address, displayed as a point geometry. -#### Arguments +##### Arguments Name | Type | Description --- | --- | --- `ip_address` | `text` | IPv4 or IPv6 address -#### Returns +##### Returns Geometry (point, EPSG 4326) or null -#### Example +##### Example -##### Update the geometry of a table to geocode it +###### Update the geometry of a table to geocode it ```bash UPDATE {tablename} SET the_geom = cdb_geocode_ipaddress_point('102.23.34.1') ``` -##### Insert a geocoded row into a table +###### Insert a geocoded row into a table ```bash INSERT INTO {tablename} (the_geom) SELECT cdb_geocode_ipaddress_point('102.23.34.1') ``` -## Street-Level Geocoder +### Street-Level Geocoder -This function geocodes your data into a point geometry for a street address. CARTO uses several different service providers for street-level geocoding, depending on your platform. If you access CARTO on a Google Cloud Platform, [Google Maps geocoding](https://developers.google.com/maps/documentation/geocoding/intro) is applied. All other platform users are provided with [Mapbox geocoding services](https://www.mapbox.com/). [Contact us](mailto:sales@carto.com) if you have any specific questions or requirements about the location data service provider being used with your account._. +This function geocodes your data into a point geometry for a street address. CARTO platform uses [Mapbox geocoding services](https://www.mapbox.com/) by default as the service provider for street-level geocoding. [Contact us](mailto:sales@carto.com) if you have any specific questions or requirements about the location data service provider being used with your account. -**This service is subject to quota limitations, and extra fees may apply**. View the [Quota information](https://carto.com/docs/carto-engine/dataservices-api/quota-information/) for details and recommendations about quota consumption. +**This service is subject to quota limitations, and extra fees may apply**. View the [Quota information]({{site.dataservicesapi_docs}}/support/quota-information/) for details and recommendations about quota consumption. -### cdb_geocode_street_point(_search_text text, [city text], [state text], [country text]_) +#### cdb_geocode_street_point(_search_text text, [city text], [state text], [country text]_) Geocodes a complete address into a single street geometry, displayed as point data. -#### Arguments +##### Arguments Name | Type | Description --- | --- | --- | --- @@ -329,19 +328,19 @@ Name | Type | Description `state` | `text` | (Optional) Name of the state. `country` | `text` | (Optional) Name of the country. -#### Returns +##### Returns Geometry (point, EPSG 4326) or null -#### Example +##### Example -##### Update the geometry of a table to geocode it +###### Update the geometry of a table to geocode it ```bash UPDATE {tablename} SET the_geom = cdb_geocode_street_point({street_name_column}) ``` -##### Insert a geocoded row into a table +###### Insert a geocoded row into a table ```bash INSERT INTO {tablename} (the_geom) SELECT cdb_geocode_street_point('651 Lombard Street', 'San Francisco', 'California', 'United States') diff --git a/doc/isoline_functions.md b/docs/developer-center/reference/06-isoline-functions.md similarity index 87% rename from doc/isoline_functions.md rename to docs/developer-center/reference/06-isoline-functions.md index 743c589..d8024f8 100644 --- a/doc/isoline_functions.md +++ b/docs/developer-center/reference/06-isoline-functions.md @@ -1,8 +1,8 @@ -# Isoline Functions +## Isoline Functions [Isolines](https://carto.com/data/isolines/) are contoured lines that display equally calculated levels over a given surface area. This enables you to view polygon dimensions by forward or reverse measurements. Isoline functions are calculated as the intersection of areas from the origin point, measured by distance (isodistance) or time (isochrone). For example, the distance of a road from a sidewalk. Isoline services through CARTO are available by requesting a single function in the Data Services API. -_**This service is subject to quota limitations and extra fees may apply**. View the [Quota Information](https://carto.com/docs/carto-engine/dataservices-api/quota-information/) section for details and recommendations about to quota consumption._ +_**This service is subject to quota limitations and extra fees may apply**. View the [Quota Information]({{site.dataservicesapi_docs}}/support/quota-information/) section for details and recommendations about to quota consumption._ 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 and inserts them into a table. @@ -12,7 +12,7 @@ https://{username}.carto.com/api/v2/sql?q=INSERT INTO {table} (the_geom) SELECT The following functions provide an isoline generator service, based on time or distance. This service uses the isolines service defined for your account. The default service limits the usage of displayed polygons represented on top of [Mapbox](https://www.mapbox.com/) maps. -## cdb_isodistance(_source geometry, mode text, range integer[], [options text[]]_) +### cdb_isodistance(_source geometry, mode text, range integer[], [options text[]]_) Displays a contoured line on a map, connecting geometries to a defined area, measured by an equal range of distance (in meters). @@ -28,7 +28,7 @@ Name | Type | Description | Accepted values `options` | `text[]` | (Optional) Multiple options to add more capabilities to the analysis. See [Optional isolines parameters](#optional-isoline-parameters) for details. -#### Returns +##### Returns Name | Type | Description --- | --- | --- @@ -36,9 +36,9 @@ Name | Type | Description `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. -#### Examples +##### Examples -##### Calculate and insert isodistance polygons from a point into another table +###### Calculate and insert isodistance polygons from a point into another table ```bash INSERT INTO {table} (the_geom) SELECT the_geom FROM cdb_isodistance('POINT(-3.70568 40.42028)'::geometry, 'walk', ARRAY[300, 600, 900]::integer[]) @@ -50,18 +50,18 @@ or equivalently: INSERT INTO {table} (the_geom) SELECT (cdb_isodistance('POINT(-3.70568 40.42028)'::geometry, 'walk', ARRAY[300, 600, 900]::integer[])).the_geom ``` -##### Calculate and insert the generated isolines from `points_table` table to another table +###### 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} ``` -## cdb_isochrone(_source geometry, mode text, range integer[], [options text[]]_) +### cdb_isochrone(_source geometry, mode text, range integer[], [options text[]]_) Displays a contoured line on a map, connecting geometries to a defined area, measured by an equal range of time (in seconds). -#### Arguments +##### Arguments 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. @@ -72,9 +72,9 @@ Name | Type | Description | Accepted values `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 +##### Examples -##### Calculate and insert isochrone polygons from a point into another table +###### Calculate and insert isochrone polygons from a point into another table ```bash INSERT INTO {table} (the_geom) SELECT the_geom FROM cdb_isochrone('POINT(-3.70568 40.42028)'::geometry, 'car', ARRAY[300, 900, 12000]::integer[], ARRAY['mode_traffic=enabled','quality=3']::text[]) @@ -86,13 +86,13 @@ or equivalently: INSERT INTO {table} (the_geom) SELECT (cdb_isochrone('POINT(-3.70568 40.42028)'::geometry, 'car', ARRAY[300, 900, 12000]::integer[], ARRAY['mode_traffic=enabled','quality=3']::text[])).the_geom ``` -##### Calculate and insert the generated isolines from `points_table` table into another table +###### Calculate and insert the generated isolines from `points_table` table into 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} ``` -### Optional isoline parameters +#### Optional isoline parameters The optional value parameters must be passed using the format: `option=value`. diff --git a/doc/demographic_functions.md b/docs/developer-center/reference/07-demographic-functions.md similarity index 98% rename from doc/demographic_functions.md rename to docs/developer-center/reference/07-demographic-functions.md index 207082d..b3564e6 100644 --- a/doc/demographic_functions.md +++ b/docs/developer-center/reference/07-demographic-functions.md @@ -1,20 +1,20 @@ -# Demographic Functions +### Demographic Functions -The Demographic Snapshot enables you to collect demographic reports around a point location. For example, you can take the coordinates of a coffee shop and find the average population characteristics, such as total population, educational attainment, housing and income information around that location. You can use raw street addresses by combining the Demographic Snapshot with CARTO's geocoding features. If you need help creating coordinates from addresses, see the [Geocoding Functions](https://carto.com/docs/carto-engine/dataservices-api/geocoding-functions/) documentation. +The Demographic Snapshot enables you to collect demographic reports around a point location. For example, you can take the coordinates of a coffee shop and find the average population characteristics, such as total population, educational attainment, housing and income information around that location. You can use raw street addresses by combining the Demographic Snapshot with CARTO's geocoding features. If you need help creating coordinates from addresses, see the [Geocoding Functions]({{site.dataservicesapi_docs}}/reference/#geocoding-functions) documentation. _**Note:** The Demographic Snapshot functions are only available for the United States._ -## OBS_GetDemographicSnapshot( point geometry ) +#### OBS_GetDemographicSnapshot( point geometry ) Fields returned include information about income, education, transportation, race, and more. Not all fields will have information for every coordinate queried. -### Arguments +##### Arguments Name | Description | Example Values --- | --- | --- point geometry | A point geometry. You can use the helper function, `CDB_LatLng` to quickly generate one from latitude and longitude | `CDB_LatLng(40.760410,-73.964242)` -### Returns +##### Returns The Demographic Snapshot contains a broad subset of demographic measures in the Data Observatory. Over 80 measurements are returned by a single API request. For each demographic measure, the API returns the following values. @@ -37,14 +37,14 @@ obs_getdemographicsnapshot: { **For details, see the [Glossary of Demographic Measures](#glossary-of-demographic-measures).** -### Examples +##### Examples ```bash https://{username}.carto.com/api/v2/sql?q=SELECT * FROM OBS_GetDemographicSnapshot({{point geometry}}) ``` -##### Get the Geographic Snapshot of a Demographic +####### Get the Geographic Snapshot of a Demographic __Get the Demographic Snapshot at Camp David__ @@ -60,7 +60,7 @@ https://{username}.carto.com/api/v2/sql?q=SELECT * FROM OBS_GetDemographicSnapshot(CDB_LatLng(40.80, -73.960)) ``` -## Glossary of Demographic Measures +#### Glossary of Demographic Measures This list contains the demographic measures and response names for results from the ```OBS_GetDemographicSnapshot``` function. diff --git a/doc/routing_functions.md b/docs/developer-center/reference/08-routing-functions.md similarity index 87% rename from doc/routing_functions.md rename to docs/developer-center/reference/08-routing-functions.md index c563e76..6de6ebe 100644 --- a/doc/routing_functions.md +++ b/docs/developer-center/reference/08-routing-functions.md @@ -1,12 +1,12 @@ -# Routing Functions +## Routing Functions 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 CARTO are available by using the available functions in the Data Services API. -## cdb_route_point_to_point(_origin geometry(Point), destination geometry(Point), mode text, [options text[], units text]_) +### cdb_route_point_to_point(_origin geometry(Point), destination geometry(Point), mode text, [options text[], units text]_) Returns a route from origin to destination. -#### Arguments +##### Arguments Name | Type | Description | Accepted values --- | --- | --- | --- @@ -17,7 +17,7 @@ Name | Type | Description | Accepted values `units` | `text` | (Optional) Unit used to represent the length of the route. | `kilometers`, `miles`. By default is `kilometers`. This option is not supported by Mapbox provider -#### Returns +##### Returns Name | Type | Description --- | --- | --- @@ -25,24 +25,24 @@ Name | Type | Description `length` | `real` | Length in the defined unit in the `units` field. `meters` by default . `the_geom` | `geometry(LineString)` | LineString geometry of the calculated route in the 4326 projection. -#### Examples +##### Examples -##### Insert the values from the calculated route in your table +###### Insert the values from the calculated route in your table ```bash INSERT INTO