Creating circle in PostGIS?

Try this:

 SELECT ST_Transform(geometry( 
            ST_Buffer(geography( 
                ST_Transform( point, 4326 )), 
                600000)), 
            900913) FROM points`

This flips into geography then uses the inbuilt SRID selection to (ironically) flip back into geometry where a good planar buffer is run then flips back. The trouble with your approach in Mercator is that Mercator doesn't preserve distance. Using a more appropriate local projection gives better results, and that is what happens in the above method.


You can increase the quad_seg value to get a more accurate circle. To get a real circle you have to work with a curved geometry type, but I don't know what software can show that.

The accuracy of srid 90013 is also very bad since it is a projection covering the whole world.

You will get a more accurate result with a local projection.


It depends where your circles are being created. Are they near the equator or closer to the poles?

Take a look at this map. Do you think Antartica or Greenland are really that big? That is the projection you are using, right?

I would recommend you do a quick read of this USGS document on projections, particularly the table below that gives you a quick idea of which projections are good for what.

And after all that, I think I should finally answer your question :)

What Nicklas said was good advice. Is there a particular projection for your local area that would work better?

Otherwise you may want to look at the new PostGIS Geography type. Nevertheless, the most appropriate answer depends on where your data is located.

UPDATE: Since now we know that your data is in Spain, did you look at storing it in a local projection like UTM Zone 31N, doing your operations using that, and then projecting them back to Google Web Mercator?