1

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.

2

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).

  • thanks for the reply. I am using google maps to collection these long, lats. I think it will give data in 4326 (by default). So you are saying with current projection we cannot use geometry to get required buffer in meters? – Dyapa Srikanth Mar 9 '15 at 13:42
  • No, with EPSG:4326 geometry you cannot. – Michal Zimmermann Mar 9 '15 at 13:56

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.