1

I have a postgis pointlayer in EPSG:3857, added to a project that is set up with OTF ON to project everything (other layers) to EPSG:3857. In postgis, I defined a view to dynamically create a buffer around the points, with a radius defined by an attribute:

CREATE VIEW point_buffer AS
     SELECT gid,st_buffer(the_geom,buf_radius) AS GEOM
FROM points_layer

It creates the buffer correctly, but when I measure the radius of the buffer in qgis, it shows the buffer without taking the ellipsoid transformation into account. (when i measure the buffer radius with OTF OFF, it shows the correct radius)

Is there a way to have a buffer around a point be scaled to the ellipsoid?

1

You can try use GEOGRAPHY data type instead of GEOMETRY data type when creating buffer. If you want to show it in QGIS, you can cast it back to GEOMETRY.

Try rewrite your command like that:

CREATE VIEW point_buffer AS
    SELECT gid, st_buffer(the_geom::geography, buf_radius)::geometry AS GEOM
FROM points_layer

Check PostGIS Geography Type documentation.

The basis for the PostGIS geometry type is a plane. The shortest path between two points on the plane is a straight line. That means calculations on geometries (areas, distances, lengths, intersections, etc) can be calculated using cartesian mathematics and straight line vectors.

The basis for the PostGIS geographic type is a sphere. The shortest path between two points on the sphere is a great circle arc. That means that calculations on geographies (areas, distances, lengths, intersections, etc) must be calculated on the sphere, using more complicated mathematics. For more accurate measurements, the calculations must take the actual spheroidal shape of the world into account, and the mathematics becomes very complicated indeed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.