better error checking for middle of the sea

This commit is contained in:
Brian Quinion
2011-02-22 20:01:26 +00:00
parent fb6d13a1a7
commit 9c41353340

View File

@@ -72,7 +72,7 @@
$fSearchDiam = 0.0001; $fSearchDiam = 0.0001;
$iPlaceID = null; $iPlaceID = null;
$aArea = false; $aArea = false;
$fMaxAreaDistance = 10; $fMaxAreaDistance = 1;
while(!$iPlaceID && $fSearchDiam < $fMaxAreaDistance) while(!$iPlaceID && $fSearchDiam < $fMaxAreaDistance)
{ {
$fSearchDiam = $fSearchDiam * 2; $fSearchDiam = $fSearchDiam * 2;
@@ -107,18 +107,19 @@
} }
// The point we found might be too small - use the address to find what it is a child of // The point we found might be too small - use the address to find what it is a child of
if ($iPlaceID)
{
$sSQL = "select address_place_id from place_addressline where cached_rank_address <= $iMaxRank and place_id = $iPlaceID order by cached_rank_address desc,isaddress desc,distance desc"; $sSQL = "select address_place_id from place_addressline where cached_rank_address <= $iMaxRank and place_id = $iPlaceID order by cached_rank_address desc,isaddress desc,distance desc";
//var_dump($sSQL);
$iPlaceID = $oDB->getOne($sSQL); $iPlaceID = $oDB->getOne($sSQL);
if (PEAR::IsError($iPlaceID)) if (PEAR::IsError($iPlaceID))
{ {
var_Dump($sSQL, $iPlaceID); var_Dump($sSQL, $iPlaceID);
exit; exit;
} }
if ($iPlaceID && $aPlace['place_id'] && $iMaxRank < 28) if ($iPlaceID && $aPlace['place_id'] && $iMaxRank < 28)
{ {
$sSQL = "select address_place_id from place_addressline where cached_rank_address <= $iMaxRank and place_id = ".$aPlace['place_id']." order by cached_rank_address desc,isaddress desc,distance desc"; $sSQL = "select address_place_id from place_addressline where cached_rank_address <= $iMaxRank and place_id = ".$aPlace['place_id']." order by cached_rank_address desc,isaddress desc,distance desc";
//var_dump($sSQL);
$iPlaceID = $oDB->getOne($sSQL); $iPlaceID = $oDB->getOne($sSQL);
if (PEAR::IsError($iPlaceID)) if (PEAR::IsError($iPlaceID))
{ {
@@ -131,6 +132,7 @@
$iPlaceID = $aPlace['place_id']; $iPlaceID = $aPlace['place_id'];
} }
} }
}
if ($iPlaceID) if ($iPlaceID)
{ {