Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#4618 closed defect (wontfix)

ST_Buffer(geography) issue

Reported by: olehz Owned by: pramsey
Priority: medium Milestone: PostGIS 3.0.1
Component: postgis Version: 3.0.x
Keywords: ST_Buffer Cc:

Description

It seems that ST_Buffer(geography point, float radius_of_buffer) works incorrect. If you visualize the blue and red circles, you will see that they do not match. Blue is slightly smaller than red. The difference is about 90 km from the west and east side.

Is this a bug or am I not understanding something?

SELECT 'blue' AS color, ST_Buffer(c, dist, 90) AS geom FROM params
UNION
SELECT
    'red' AS color, ST_MakePolygon(ST_MakeLine(points || points[1])) AS geom
FROM (
    SELECT
        ARRAY_AGG(p) points
    FROM params,
        generate_series(0, 359, 1) deg,
        Geometry(ST_Project(c, dist, RADIANS(deg))) p
) z

https://nadoloni.com/buffer.png

Attachments (1)

buffer.png (94.2 KB ) - added by olehz 4 years ago.

Download all attachments as: .zip

Change History (3)

by olehz, 4 years ago

Attachment: buffer.png added

comment:1 by olehz, 4 years ago

WITH params AS (
    SELECT ST_GeographyFromText('POINT(10.715 59.940)') AS c, 2407600 AS dist
)


SELECT 'blue' AS color, ST_Buffer(c, dist, 90) AS geom FROM params
UNION
SELECT
    'red' AS color, ST_MakePolygon(ST_MakeLine(points || points[1])) AS geom
FROM (
    SELECT
        ARRAY_AGG(p) points
    FROM params,
        generate_series(0, 359, 1) deg,
        Geometry(ST_Project(c, dist, RADIANS(deg))) p
) z

comment:2 by robe, 4 years ago

Resolution: wontfix
Status: newclosed

ST_Buffer in geography is not a native function. It piggy backs on geometry ST_Buffer and in doing so chooses a best guess spatial reference system for the point before applying the buffer. That said for large buffers, its going to have more and more errors as your buffer size grows.

This is not a bug just an implementation limitation. As noted in the docs - http://postgis.net/docs/manual-3.0/ST_Buffer.html all assumptions fall apart with large buffers.

Last edited 4 years ago by robe (previous) (diff)
Note: See TracTickets for help on using tickets.