+
+ if (CONST_Debug) var_dump($sSQL);
+ $aPlacNode = chksql(
+ $this->oDB->getRow($sSQL),
+ 'Could not determine place node.'
+ );
+ if ($aPlacNode) {
+ return $aPlacNode;
+ }
+
+ // still nothing, then return the country object
+ $sSQL = 'SELECT place_id, ST_distance('.$sPointSQL.', centroid) as distance';
+ $sSQL .= ' FROM placex';
+ $sSQL .= ' WHERE country_code = \''.$sCountryCode.'\'';
+ $sSQL .= ' AND rank_search = 4 AND rank_address = 4';
+ $sSQL .= ' AND class in (\'boundary\', \'place\')';
+ $sSQL .= ' ORDER BY distance ASC';
+