If you create a point dataset in CartoDB then export it to CSV, you get a "the_geom" column in the WKB format. How do you get individual lat and lon columns?


Since CartoDB uses PostGIS, you can use PostGIS functions:

  1. On the SQL tab (Map View), modify the default query to look something like this:

SELECT *, ST_X(the_geom) AS lon, ST_Y(the_geom) AS lat FROM mytable

  1. Under "Edit" select "Export Layer" and choose CSV.
  • If the geom is a polygon, you can export the lat and lon using this: ST_X(ST_Centroid(the_geom)) and ST_Y(ST_Centroid(the_geom)) – ssaltman Aug 31 '17 at 14:21

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.