I have a rails app that is using rgeo 0.3.19 with proj4 support connecting to a PostGIS 1.5 database with the rgeo-activerecord 0.4.5 gem.
My app has a model called Region which contains a geographic point, a radius, and a polygon shape. When a new region is about to save it uses the region's geofactory's buffer function to create a polygon using the radius and the geographic point.
Here is the geofactory that is being used for the region model
GEOFACTORY = RGeo::Geographic.projected_factory(:buffer_resolution => 8, :projection_proj4 => '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', :projection_srid => 3857)
The projection_srid I am using is that of Apple and Google maps mercator projection 3857. The problem is that the buffer that is being created is not the same size as the one I am drawing in either apple maps or google maps. For example, if I use the built in MapKit function MKCircle
[MKCircle circleWithCenterCoordinate:self.coordinate radius:50];
The circle will draw and overlay like this.
But if I take the coordinates that were created form the buffer function that make up the polygon shape in the database and plot them on google maps I get this.
As you can see, the polygon that was created using the same projection system is smaller than it should be. This problem exponentially grows out of control based on the size of the radius defined. I have also tried to use the simple_mercator factory as defined in RGeo which yielded the same results.
Hopefully somebody has some insight into why, when a longitude,latitude projected point is buffered it creates an incorrectly sized polygon.