# Calculating radius / buffer on EPSG 3785 in meters vs buffer in WGS 84 in meters

The goal is working in EPSG 3785 and in particular Google Maps, one wishes to render (on a tile) a circle of a given radius in meters. The rendering is done in pixels.

I would guess that one could take a very simple linear approach to identify the meters per pixel for a given tile zoom:

metersPerPixel = MercWorldWidthMeters / (2 ^ zoom) / tileSize

Now, considering you wish to draw a radius of let's say 100 meters around a point in pixels, then you convert to pixels:

This should in my mind produce a circle of metersRadius on the tile.

However, actually measuring the produced circle's radius with a circle produced in WGS 84 and Great Circle logic, it shows that it is actually about 40% smaller than expected... a big difference.

Does the logic above have a flaw?

Note that I am not interested in finding an alternative algorithm (going to Great Circle calculations and the like)... my question here is "why are the results (so much) different than expected".

All conversions this far have been working fine with the above logic but once I decided to calculate actual distance on EPSG 3785 I seem to be hitting a break wall.

To give an example with figures:

Radius: 0.08 miles ( = 128.74752 meters )
MercWorldWidthMeters: 20037508.342789 * 2
Zoom: 16
TileSize: 256

Above logic suggests a circle of ~107 pixels diameter.
Great Circle suggests a circle of ~175 pixels diameter.

-

## migrated from stackoverflow.comDec 16 '11 at 2:28

This question came from our site for professional and enthusiast programmers.

Curvature of the earth? ;) rendering the radius of circular area on the surface of a sphere vs that of a radius of a 2-dimensional circle? Take the case where the circular area spans half of the earth (a hemisphere) the 2D radius would be r (the radius of the earth) whereas the one on a spherical surface would be pi*r. Just grasping at straws becuase time's almost up ;) – skeryl Dec 16 '11 at 1:06
Maybe this thread can help "Better Distance Measurements in Web Mercator Projection" gis.stackexchange.com/questions/14528/… – underdark Dec 16 '11 at 8:14
skeryl - I don't see how curvature can affect the radius at this scale. The error factor at this scale is very low to throw it so far off. – George Dec 22 '11 at 9:25
underdark - +1 for a good reference. I think the answer from mkadunc attempts to answer it although I am still not convinced that is the reason. – George Dec 22 '11 at 9:29