I am trying to create a base map suitable for overlaying data that is in SRS EPSG:4326 using CartoDB following the projections tutorial. I have other projections working, but not one for this.

So using:

  SELECT cartodb_id, ST_Transform(the_geom, 4326) AS the_geom_webmercator
  FROM world_borders_hd 

It does not seem to return any geometries plotted in the tiles.

From a comment on the CartoDB academy issue I posted, I presume this is something to do with a scale that needs to be applied in the transformation from degrees to meters.

Can anyone advise me what I need to do in the SQL to get a zoom 0 tile that would look like this?

example image

1 Answer 1


You can scale the coordinates like this to map the circumference in longitude (180 - -180 = 360) to the diameter of the earth in meters (40.075 million m) which is what web mercator uses. The conversion is 40,075,000 / 360 = 111319.44444444444444

SELECT ST_Scale(the_geom, 111319.44444444444444, 111319.44444444444444) As the_geom_webmercator 
FROM world_borders_hd

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.