Merge pull request #186 from CartoDB/master
edited geocoding code example
This commit is contained in:
commit
ed667dc301
@ -13,7 +13,7 @@ https://{username}.cartodb.com/api/v2/sql?q=SELECT cdb_geocode_admin0_polygon('U
|
||||
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 Data Services 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_
|
||||
https://{username}.cartodb.com/api/v2/sql?q=UPDATE {tablename} SET the_geom = cdb_geocode_admin0_polygon('USA')&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:
|
||||
|
Loading…
Reference in New Issue
Block a user