From b1e10bce0d0b0cae4f401305608154c898311755 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Sun, 18 Mar 2012 18:18:33 +0100 Subject: [PATCH 1/1] use X/Y max/min functions instead of box making There is a strange bug in postgis where for some coordinates it does not make a proper box around a point. --- website/details.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/details.php b/website/details.php index eeb48656..a4cb8b96 100755 --- a/website/details.php +++ b/website/details.php @@ -71,8 +71,8 @@ // Get the bounding box and outline polygon $sSQL = "select ST_AsText(geometry) as outlinestring,"; - $sSQL .= "ST_Y(ST_PointN(ExteriorRing(ST_Box2D(geometry)),4)) as minlat,ST_Y(ST_PointN(ExteriorRing(ST_Box2D(geometry)),2)) as maxlat,"; - $sSQL .= "ST_X(ST_PointN(ExteriorRing(ST_Box2D(geometry)),1)) as minlon,ST_X(ST_PointN(ExteriorRing(ST_Box2D(geometry)),3)) as maxlon"; + $sSQL .= "ST_YMin(geometry) as minlat,ST_YMax(geometry) as maxlat,"; + $sSQL .= "ST_XMin(geometry) as minlon,ST_XMax(geometry) as maxlon"; $sSQL .= " from placex where place_id = $iPlaceID"; $aPointPolygon = $oDB->getRow($sSQL); IF (PEAR::IsError($aPointPolygon)) -- 2.39.5