0

I'm trying to alter my data on cartodb map to get maritime emissions over about 20 years- by country. Hence trying get a torque map for polygons, and by changing polygons to points based on a previous suggestion:

SELECT ST_Centroid(the_geom) the_geom, carto_date FROM maritime_emissions_my_data_trial_copy

But I keep getting a syntax error at SELECT.... the_geom appears to be properly valued - all rows state "Polygon".

My data is here: http://bit.ly/1M77NjG

I'm quite a novice.

1
  • Did you update the_geom_webmercator as stated in the post you refer to. You are probably better off creating a new table with points instead of polygons and running torque off that. As far as I know, polygons are still not supported. Dec 11, 2015 at 14:19

2 Answers 2

1

Almost there! The difference is that CartoDB needs the geometry to be aliased as the_geom_webmercator. Also, make sure to use the (hidden) the_geom_webmercator to avoid having to project the_geom to web mercator. You should also include the primary key of the table (cartodb_id).

The following should work:

SELECT 
    ST_Centroid(the_geom_webmercator) As the_geom_webmercator, 
    carto_date,
    cartodb_id
FROM 
  maritime_emissions_my_data_trial_copy
2
  • Thankyou for suggestion - tried that but still getting "syntax error in or around SELECT"! Dec 11, 2015 at 15:20
  • Hmm.. are you sure that there is no other text in the SQL tray other than the query in the code block above? I got the query working from the data you provided. Dec 11, 2015 at 18:15
0

From the error message I would assume that there is an error in the SELECT statement which is independent of the data. Is the missing comma between ST_Centroid(the_geom) and the_geom a typo in the post?

Does

SELECT ST_Centroid(the_geom), the_geom, carto_date FROM maritime_emissions_my_data_trial_copy

instead of

SELECT ST_Centroid(the_geom) the_geom, carto_date FROM maritime_emissions_my_data_trial_copy

?

If not, please post the full error message.

3
  • Thankyou for suggestion - tried that but still getting "syntax error in or around SELECT"! Dec 11, 2015 at 15:20
  • Which error message do you exactly get? Dec 11, 2015 at 15:26
  • "syntax error in or around SELECT" Dec 11, 2015 at 15:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.