-
- // Get the bounding box and outline polygon
- $sSQL = "select ST_AsText(geometry) as outlinestring,";
- $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))
- {
- failInternalError("Could not get bounding box of place object.", $sSQL, $aPointPolygon);
- }
- if (preg_match('#POLYGON\\(\\(([- 0-9.,]+)#',$aPointPolygon['outlinestring'],$aMatch))
- {
- preg_match_all('/(-?[0-9.]+) (-?[0-9.]+)/',$aMatch[1],$aPolyPoints,PREG_SET_ORDER);
- }
- elseif (preg_match('#MULTIPOLYGON\\(\\(\\(([- 0-9.,]+)#',$aPointPolygon['outlinestring'],$aMatch))
- {
- // TODO: this just takes the first ring
- preg_match_all('/(-?[0-9.]+) (-?[0-9.]+)/',$aMatch[1],$aPolyPoints,PREG_SET_ORDER);
- }
- elseif (preg_match('#POINT\\((-?[0-9.]+) (-?[0-9.]+)\\)#',$aPointPolygon['outlinestring'],$aMatch))