reorg of docs format and editing, removed mentions of providers
This commit is contained in:
parent
6105f677af
commit
30cb5869f1
13
doc/API.md
13
doc/API.md
@ -2,13 +2,10 @@
|
||||
|
||||
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 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
|
||||
|
||||
* [Quickstart](quickstart.md)
|
||||
* [General concepts](general_concepts.md)
|
||||
* [Geocoding functions](geocoding_functions.md)
|
||||
* [Isoline functions](isoline_functions.md)
|
||||
* [Overview](overview.md)
|
||||
* [Geocoding Functions](geocoding_functions.md)
|
||||
* [Isoline Functions](isoline_functions.md)
|
||||
* [Routing Functions](routing_functions.md)
|
||||
* [Quota Information](quota_information.md)
|
||||
|
@ -1,33 +0,0 @@
|
||||
# General concepts
|
||||
|
||||
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 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/).
|
||||
|
||||
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 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 request. An example is as follows:
|
||||
|
||||
```json
|
||||
{
|
||||
error: [
|
||||
"The api_key must be provided"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
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 Data Services API is subject to the CartoDB SQL API limits, stated in our [Terms of Service](https://cartodb.com/terms/#excessive).
|
@ -1,7 +1,25 @@
|
||||
# Geocoding Functions
|
||||
|
||||
The following geocoding functions are available, grouped by categories.
|
||||
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. Geocoding functions through CartoDB 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](http://docs.cartodb.com/cartodb-platform/dataservices-api/quota-information/) section for details, and recommendations, about to quota consumption.
|
||||
|
||||
|
||||
## Quickstart
|
||||
|
||||
Here is an example of how to geocode a single country:
|
||||
|
||||
```bash
|
||||
https://{username}.cartodb.com/api/v2/sql?q=SELECT cdb_geocode_admin0_polygon('USA')&api_key={api_key}
|
||||
```
|
||||
|
||||
In order to geocode an existent CartoDB dataset, an SQL UPDATE statement must be used to populate the geometry column in the dataset with the results of the Geocoding API. For example, if the column where you are storing the country names for each one of our rows is called `country_column`, run the following statement in order to geocode the dataset:
|
||||
|
||||
```bash
|
||||
https://{username}.cartodb.com/api/v2/sql?q=UPDATE {tablename} SET the_geom = cdb_geocode_admin0_
|
||||
```
|
||||
|
||||
The following geocoding functions are available, grouped by categories.
|
||||
|
||||
## Country geocoder
|
||||
|
||||
@ -278,12 +296,12 @@ This function provides a street-level geocoding service. This service uses the s
|
||||
|
||||
#### Arguments
|
||||
|
||||
Name | Type | Description | Provider
|
||||
Name | Type | Description
|
||||
--- | --- | --- | ---
|
||||
`searchtext` | `text` | searchtext contains free-form text containing address elements. You can specify the searchtext parameter by itself, or 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. | Here, Google, Mapzen
|
||||
`city` | `text` | (Optional) Name of the city. | Here and Google
|
||||
`state` | `text` | (Optional) Name of the state. | Here and Google
|
||||
`country` | `text` | (Optional) Name of the country. *If you are using **Mapzen** as the geocoder provider, you must use alpha-2 or alpha-3 [ISO-3166](https://en.wikipedia.org/wiki/ISO_3166-1) country codes* | Here, Google and Mapzen
|
||||
`searchtext` | `text` | searchtext contains free-form text containing address elements. You can specify the searchtext parameter by itself, or 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
|
||||
|
||||
@ -293,25 +311,18 @@ Geometry (point, EPSG 4326) or null
|
||||
|
||||
##### Select
|
||||
|
||||
Using **Here** or **Google** as the geocoder provider
|
||||
Using SELECT for geocoding functions
|
||||
|
||||
```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')
|
||||
```
|
||||
|
||||
Using **Mapzen** as the geocoder provider
|
||||
|
||||
```bash
|
||||
SELECT cdb_geocode_street_point('651 Lombard Street San Francisco California', NULL, NULL, 'USA')
|
||||
```
|
||||
|
||||
**Tip:** If you are using the Mapzen API for geocoding, see the integration details in the [Quickstart](http://docs.cartodb.com/cartodb-platform/dataservices-api/quickstart/#using-mapzen-services) section.
|
||||
|
||||
##### Update
|
||||
|
||||
```bash
|
||||
UPDATE {tablename} SET the_geom = cdb_geocode_street_point({street_name_column})
|
||||
```
|
||||
```
|
@ -1,10 +1,27 @@
|
||||
# Isoline functions
|
||||
# Isoline Functions
|
||||
|
||||
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).
|
||||
[Isolines](https://cartodb.com/data/isolines/) are contoured lines that display 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 functions through CartoDB are available by requesting a single function in the Data Services API.
|
||||
|
||||
**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.
|
||||
**This service is subject to quota limitations, and extra fees may apply**. View the [Quota Information](http://docs.cartodb.com/cartodb-platform/dataservices-api/quota-information/) section for details, and recommendations, about to quota consumption.
|
||||
|
||||
### cdb_isodistance(_source geometry, mode text, range integer[], [options text[]]_)
|
||||
## Quickstart
|
||||
|
||||
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.
|
||||
polygon({country_column})&api_key={api_key}
|
||||
|
||||
```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={api_key}
|
||||
```
|
||||
|
||||
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={api_key}
|
||||
```
|
||||
|
||||
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 [HERE](https://developer.here.com/coverage-info) maps.
|
||||
|
||||
## cdb_isodistance(_source geometry, mode text, range integer[], [options text[]]_)
|
||||
|
||||
#### Arguments
|
||||
|
||||
@ -48,7 +65,7 @@ SELECT the_geom FROM cdb_isodistance('POINT(-3.70568 40.42028)'::geometry, 'walk
|
||||
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[]]_)
|
||||
|
||||
#### Arguments
|
||||
|
||||
|
41
doc/overview.md
Normal file
41
doc/overview.md
Normal file
@ -0,0 +1,41 @@
|
||||
# Overview
|
||||
|
||||
By using CartoDB libraries and the SQL API, you can apply location data services to your maps with select functions. These functions are integrated with a number of internal and external services, enabling you to programatically customize subsets of data for your visualizations. For example, you can transform an address to a geometry with [geocoding functions](http://docs.cartodb.com/cartodb-platform/dataservices-api/geocoding-functions/#geocoding-functions). You can also use [isoline functions](http://docs.cartodb.com/cartodb-platform/dataservices-api/isoline-functions/#isoline-functions) to calculate the travel distance for a defined area. 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](http://docs.cartodb.com/cartodb-platform/dataservices-api/quota-information/#quota-information).
|
||||
|
||||
_The Data Services API is collaborating with Mapzen, and several other geospatial service providers, in order to supply the best location data services from within our CartoDB Platform._
|
||||
|
||||
## General Concepts
|
||||
|
||||
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.
|
||||
|
||||
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/).
|
||||
|
||||
**Note:** The Data Services API [geocoding functions]((http://docs.cartodb.com/cartodb-platform/dataservices-api/geocoding-functions/#geocoding-functions) return different types of geometries (points or polygons) as result of different geocoding processes. The CartoDB Platform 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.
|
||||
|
||||
## Authentication
|
||||
|
||||
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/) documentation.
|
||||
|
||||
## Errors
|
||||
|
||||
Errors are described in the response of the request. An example is as follows:
|
||||
|
||||
```json
|
||||
{
|
||||
error: [
|
||||
"The api_key must be provided"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
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 Data Services API is subject to the CartoDB SQL API limits, stated in our [Terms of Service](https://cartodb.com/terms/#excessive).
|
@ -1,37 +0,0 @@
|
||||
# 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 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:
|
||||
|
||||
```bash
|
||||
https://{username}.cartodb.com/api/v2/sql?q=SELECT cdb_geocode_admin0_polygon('USA')&api_key={Your API key}
|
||||
```
|
||||
|
||||
In order to geocode an existent CartoDB dataset, an SQL UPDATE statement must be used to populate the geometry column in the dataset with the results of the Geocoding API. For example, if the column where you are storing the country names for each one of our rows is called `country_column`, run the following statement in order to geocode the dataset:
|
||||
|
||||
```bash
|
||||
https://{username}.cartodb.com/api/v2/sql?q=UPDATE {tablename} SET the_geom = cdb_geocode_admin0_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.
|
||||
polygon({country_column})&api_key={Your API key}
|
||||
```
|
||||
|
||||
```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 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}
|
||||
```
|
||||
|
||||
## Using Mapzen Services
|
||||
|
||||
You can use Mapzen as the service provider for [geocoding](http://docs.cartodb.com/cartodb-platform/dataservices-api/#geocoding-functions) and [routing](http://docs.cartodb.com/cartodb-platform/dataservices-api/#routing-functions) with CartoDB. This enables you to take advantage of the [geocoding search](https://mapzen.com/documentation/search/) features, and the [turn-by-turn routing](https://mapzen.com/documentation/turn-by-turn/) service that Mapzen offers. To use these features through CartoDB, all you need is a Mapzen API Key.
|
||||
|
||||
Integration with Mapzen varies, depending on your account plan:
|
||||
|
||||
- Enterprise account users will receive a Mapzen API Key through CartoDB
|
||||
- All other account plans can go to the [Mapzen Developers page](https://mapzen.com/developers/sign_in) to retrieve an API key. This is a free integration that allows you to access the Mapzen services by connecting your GitHub account
|
||||
|
||||
**Tip** You can also use [Mapzen basemaps](https://mapzen.com/documentation/vector-tiles/) by integrating with their API. This is useful is you want to include a vector tile service basemap with your CartoDB map. To include their external basemaps, define the URL and Mapzen attributions in the [HTTP data layer of your MapConfig](http://docs.cartodb.com/cartodb-platform/maps-api/mapconfig/#http-layer-options) file. Currently, Mapzen vector tile basemaps are only supported via the API, and are not available through the CartoDB Editor.
|
@ -1,17 +1,11 @@
|
||||
# Quota information
|
||||
# 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/).
|
||||
**Based on your account plan, some of the Data Services API functions are subject to quota limitations and extra fees may apply.** View our [terms and conditions](https://cartodb.com/terms/), or [contact us](mailto:sales@cartodb.com) for details about which functions require service credits to your account.
|
||||
|
||||
The functions that require service credits to be used are as follows:
|
||||
## Quota Consumption
|
||||
|
||||
* 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 is calculated based on the number of request made for each function. Be mindful of the following usage recommendations when using the Data Services API 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.
|
||||
* One credit per function call will be consumed. The results are not cached. If the query is applied to a _N_ rows dataset, then _N_ credits are consumed
|
||||
* Avoid running dynamic queries to these functions in your maps. This can result in credit 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
|
||||
* It is advised to store results of these queries into your datasets, and refresh them as needed. This ensure more control of quota credits for your account
|
||||
|
Loading…
Reference in New Issue
Block a user