[GIS] How to create buffer around point having projection 4326

buffercoordinate systemlatitude longitudepostgis-2.0

I am trying to create buffer (in meters) around point(long lat alt) which is in projection 4326 with below code. But it is not giving expected output.

SELECT ST_AsTEXT(ST_Buffer((ST_GeomFromText('POINT(78.385333 17.433293 0)', 4326)),63.763271854));

But if i convert point to geography it is giving correct result.

SELECT ST_AsTEXT(ST_Buffer((ST_GeomFromText('POINT(78.385333 17.433293 0)', 4326))::geography,63.763271854));

What this st_buffer doing with geography datatype. Without converting it to geography how can i do that? I am new to postgis.

Best Answer

The basis for the PostGIS geographic type is a sphere.

The basis for the PostGIS geometry type is a plane. (same link)

Thus, when you run ST_Buffer on a EPSG:4326 geometry, the output is given in degrees of lat/lon. On the other hand, when you do the same for EPSG:4326 geography, you get result in meters.

What you can do (besides using geography type) is projecting your data into the "better" CRS than EPSG:4326 (i.e. national grid system).

Related Question