From: Sarah Hoffmann Date: Sun, 18 Mar 2012 17:18:33 +0000 (+0100) Subject: use X/Y max/min functions instead of box making X-Git-Tag: v2.0.0~97^2~2 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/b1e10bce0d0b0cae4f401305608154c898311755 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. --- 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))