For a spatial search I need a 900km buffer around a given point(lon 18 degrees, lat 63 degrees) and search all geometries in a table that intersect with the envelope around the buffer( actually a quadrat or rectangle depends where you look at it). The geometry records in the table have SRID 4326. My problem is the envelope object I get does not seem to be correct. I use the following:
select st_astext( st_transform( st_envelope( st_buffer( st_transform( ST_GeomFromText('POINT(18 63)', 4326), 3857), 900000)), 4326));
First I convert the center point to srid 3857 which is meter based, create a buffer with 900000m radius(a circle in 3857 srid), than make an envelope around the buffer( a quadrat in 3857), and convert it back to 4326 where I will get a rectangle. The result is the Polygon below:
POLYGON((9.9151 59.0917, 9.9151 66.4469, 26.0848 66.4469, 26.0848 59.0917, 9.9151 59.0917))
I have removed some of the decimals returned. As seen the polygon has a width of about 17 longitude degrees which seems ok, but the heigth is only about 6,6 latitude degrees that is much too short. What am I doing wrong? Is the accuracy for such large buffers so poor? When the center point has the coordinates POINT(18 33) with a lower latitude value the results seem to be Ok. I use PostgreSQL 9.6 and PostGIS 2.2 on Windows.