Question

I am trying to develop a GIS application in which i would like to limit the area of geofence of buffer created.

Is there postgis function to find the radius of buffer or bounds of a geofence?

Was it helpful?

Solution

You can use ST_Envelope to get the extents of a bounding box around some feature, in, the minimum bounding rectangle (MBR).

select ST_Astext(ST_Envelope(ST_Buffer(ST_Makepoint(0,0),10)));

returns a rectangle not a circle

POLYGON((-10 -10,-10 10,10 10,10 -10,-10 -10))

You can then use the min and max functions, ST_Xmax, ST_Xmin and the Y equivalents to get the width, height of the MBR.

Is this what you asked?

OTHER TIPS

Thanks John,

I asked the question wrongly, My actual requirement was that the fence must not cross the allowed bounds. I first thought of limiting the radius of fence but it can be done using st_contains since it matches my actual requirement.

Select st_contains ((select the_geom from gis.city_border),(select the_geom from geofence))

Solved.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top