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.

  • 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. – John Powell Dec 11 '15 at 14:19
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
  • Thankyou for suggestion - tried that but still getting "syntax error in or around SELECT"! – Margot Haslanger Dec 11 '15 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. – Andy Eschbacher Dec 11 '15 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.

  • Thankyou for suggestion - tried that but still getting "syntax error in or around SELECT"! – Margot Haslanger Dec 11 '15 at 15:20
  • Which error message do you exactly get? – daniel.neumann Dec 11 '15 at 15:26
  • "syntax error in or around SELECT" – Margot Haslanger Dec 11 '15 at 15:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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