[GIS] Using negative radius buffer for ST_Buffer

bufferpostgis

I am using postgis 2.2.

I am using ST_Buffer to my polygon and it's working for positive radius (in meters) but when i am going to apply negative radius it is showing empty values.

Here is my query:

SELECT    
  ST_AsGeoJSON(
      ST_Buffer(
          ST_GeomFromText(
               'POLYGON((72.89994120597838 19.070245311788284,
                         72.89981782436371 19.069915760688904,
                         72.9002845287323 19.070001951039718,
                         72.900338172912619.070341641985888,
                         72.89991974830626 19.07023517176424,
                         72.89994120597838 19.070245311788284)
               )', 4326)
       ,-3.024)
  ) as geometry;

The Results are :

            geometry
-------------------------------------
 {"type":"Polygon","coordinates":[]}
(1 row)

How to apply negative buffer (-10 meters) to polygon (in meters)?

Best Answer

Use reasonable buffer value. The largest measure of your polygon is about 0.0007 degrees and you are shrinking it by 3.024 degrees. The result if much less than nothing.

SELECT ST_AsGeoJSON(ST_Buffer(ST_GeomFromText('POLYGON((72.89994120597838 19.070245311788284,72.89981782436371 19.069915760688904,72.9002845287323 19.070001951039718,72.9003381729126 19.070341641985888,72.89991974830626 19.07023517176424,72.89994120597838 19.070245311788284))', 4326), -0.0001)) as geometry;

gives

"{"type":"Polygon","coordinates":[[[72.9000145913706,19.0701561184588],[72.9002157176618,19.0702072960437],[72.9001967896964,19.0700874385229],[72.8999734347906,19.0700461896318],[72.9000145913706,19.0701561184588]]]}"

Related Question