0

I have a linestring geometry in my PostgreSQL database. I want to get the corner coordinates of the rectangular bounding box. Example

"0102000020E610000002000000CCDA5CEB41D323406E2A9CEE86C54A40CCDA5CEB41D323406E2A9CEE86C54A40"
"0102000020E610000002000000AF5FB01BB6CD22407C7E18213C8E4A40AF5FB01BB6CD22407C7E18213C8E4A40"

Until now, I have executed the query

SELECT ST_Extent(geomtery) as bextent from warning_060219;

result

BOX(6.84285 51.37265,11.55307 54.36356)

How can I get the four corner coordinates of the rectangle?

1

You can use ST_Xmin, ST_Xmax, ST_Ymin and ST_Ymax

WITH ext AS 
 (SELECT ST_Extent(geomtery) as bextent 
  from warning_060219)
SELECT
  ST_Xmin(bextent), 
  ST_Xmax(bextent), 
  ST_Ymin(bextent),
  ST_Ymax(bextent)
FROM ext;

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.