- $fSearchDiam = 0.001;
- if ($aPlace['rank_search'] == 30)
- {
- // if a house was found, the closest road needs to be searched, to use its place id as parent_place_id of the interpolation line
- // because a road can be closer to the point than the house from above
- $iRoadID = null;
- while(!$iRoadID && $fSearchDiam < $fMaxAreaDistance)
- {
- $fSearchDiam = $fSearchDiam * 2;
- $sSQL = 'select place_id ';
- $sSQL .= ' FROM placex';
- $sSQL .= ' WHERE ST_DWithin('.$sPointSQL.', geometry, '.$fSearchDiam.')';
- $sSQL .= ' and (rank_search = 26 or rank_search = 27)';
- $sSQL .= ' and class not in (\'waterway\',\'railway\',\'tunnel\',\'bridge\',\'man_made\')';
- $sSQL .= ' and indexed_status = 0 ';
- $sSQL .= ' ORDER BY ST_distance('.$sPointSQL.', geometry) ASC limit 1';
- $aPlaceRoad = $this->oDB->getRow($sSQL);
- if (PEAR::IsError($aPlace))
- {
- failInternalError("Could not determine closest place.", $sSQL, $aPlace);
- }
- $iRoadID = $aPlaceRoad['place_id'];
- $iTempPlaceID = $iRoadID;
- }
- }
- else
- {
- // if a street was found, we can take its place_id as parent_place_id
- $iTempPlaceID = $iPlaceID;
- }