From 982f178d5a5ad2ff77cd25e76d04b5a602d3cfd8 Mon Sep 17 00:00:00 2001 From: csobier Date: Fri, 20 May 2016 13:38:04 -0400 Subject: [PATCH] edited geocoding code example --- doc/geocoding_functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/geocoding_functions.md b/doc/geocoding_functions.md index 232d0ea..ef5dc2f 100644 --- a/doc/geocoding_functions.md +++ b/doc/geocoding_functions.md @@ -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: