]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/Geocode.php
Fix coding style.
[nominatim.git] / lib / Geocode.php
index 4b15b3c814980588f7849f5428f8f574ffd7dad1..481be133513447b4b300200653e62e0b12ab0330 100644 (file)
                        $sLanguagePrefArraySQL = "ARRAY[".join(',',array_map("getDBQuoted",$this->aLangPrefOrder))."]";
 
                        // Get the details for display (is this a redundant extra step?)
                        $sLanguagePrefArraySQL = "ARRAY[".join(',',array_map("getDBQuoted",$this->aLangPrefOrder))."]";
 
                        // Get the details for display (is this a redundant extra step?)
-                       $sPlaceIDs = join(',',array_keys($aPlaceIDs));
+                       $sPlaceIDs = join(',', array_keys($aPlaceIDs));
 
                        $sImportanceSQL = '';
                        if ($this->sViewboxSmallSQL) $sImportanceSQL .= " case when ST_Contains($this->sViewboxSmallSQL, ST_Collect(centroid)) THEN 1 ELSE 0.75 END * ";
 
                        $sImportanceSQL = '';
                        if ($this->sViewboxSmallSQL) $sImportanceSQL .= " case when ST_Contains($this->sViewboxSmallSQL, ST_Collect(centroid)) THEN 1 ELSE 0.75 END * ";
                                //Tiger search only if a housenumber was searched and if it was found (i.e. aPlaceIDs[placeID] = housenumber != -1) (realized through a join)
                                //only Tiger housenumbers need to be interpolated, because they are saved as lines with start- and endnumber, the common osm housenumbers are usually saved as points
                                $sHousenumbers = "";
                                //Tiger search only if a housenumber was searched and if it was found (i.e. aPlaceIDs[placeID] = housenumber != -1) (realized through a join)
                                //only Tiger housenumbers need to be interpolated, because they are saved as lines with start- and endnumber, the common osm housenumbers are usually saved as points
                                $sHousenumbers = "";
-                               $i=0;
-                               $length=count($aPlaceIDs);
-                               foreach($aPlaceIDs as $placeID => $housenumber){
+                               $i = 0;
+                               $length = count($aPlaceIDs);
+                               foreach($aPlaceIDs as $placeID => $housenumber)
+                {
                                        $i++;
                                        $sHousenumbers .= "(".$placeID.", ".$housenumber.")";
                                        if($i<$length)
                                        $i++;
                                        $sHousenumbers .= "(".$placeID.", ".$housenumber.")";
                                        if($i<$length)
                        }
 
                        // Do we have anything that looks like a lat/lon pair?
                        }
 
                        // Do we have anything that looks like a lat/lon pair?
-                       if ( $aLooksLike = looksLikeLatLonPair($sQuery) ){
+                       if ( $aLooksLike = looksLikeLatLonPair($sQuery) )
+            {
                                $this->setNearPoint(array($aLooksLike['lat'], $aLooksLike['lon']));
                                $sQuery = $aLooksLike['query'];
                        }
                                $this->setNearPoint(array($aLooksLike['lat'], $aLooksLike['lon']));
                                $sQuery = $aLooksLike['query'];
                        }
                                        foreach($aSearches as $aSearch)
                                        {
                                                $iQueryLoop++;
                                        foreach($aSearches as $aSearch)
                                        {
                                                $iQueryLoop++;
-                                               $searchedHousenumber=-1;
+                                               $searchedHousenumber = -1;
 
                                                if (CONST_Debug) { echo "<hr><b>Search Loop, group $iGroupLoop, loop $iQueryLoop</b>"; }
                                                if (CONST_Debug) _debugDumpGroupedSearches(array($iGroupedRank => array($aSearch)), $aValidTokens);
 
                                                if (CONST_Debug) { echo "<hr><b>Search Loop, group $iGroupLoop, loop $iQueryLoop</b>"; }
                                                if (CONST_Debug) _debugDumpGroupedSearches(array($iGroupedRank => array($aSearch)), $aValidTokens);
                                                                if (!sizeof($aPlaceIDs))
                                                                {
                                                                        //new query for lines, not housenumbers anymore
                                                                if (!sizeof($aPlaceIDs))
                                                                {
                                                                        //new query for lines, not housenumbers anymore
-                                                                       if($searchedHousenumber%2==0){
+                                                                       if($searchedHousenumber%2 == 0){
                                                                                //if housenumber is even, look for housenumber in streets with interpolationtype even or all
                                                                                $sSQL = "select distinct place_id from location_property_tiger where parent_place_id in (".$sPlaceIDs.") and (interpolationtype='even' or interpolationtype='all') and ".$searchedHousenumber.">=startnumber and ".$searchedHousenumber."<=endnumber";
                                                                        }else{
                                                                                //if housenumber is even, look for housenumber in streets with interpolationtype even or all
                                                                                $sSQL = "select distinct place_id from location_property_tiger where parent_place_id in (".$sPlaceIDs.") and (interpolationtype='even' or interpolationtype='all') and ".$searchedHousenumber.">=startnumber and ".$searchedHousenumber."<=endnumber";
                                                                        }else{
                                                                {
                                                                        $aPlaceIDs = $aRoadPlaceIDs;
                                                                        //set to -1, if no housenumbers were found
                                                                {
                                                                        $aPlaceIDs = $aRoadPlaceIDs;
                                                                        //set to -1, if no housenumbers were found
-                                                                       $searchedHousenumber=-1;
-                                                               }else{
-                                                                       //housenumber was found, remains saved in searchedHousenumber
+                                                                       $searchedHousenumber = -1;
                                                                }
                                                                }
+                                //else: housenumber was found, remains saved in searchedHousenumber
                                                        }
 
 
                                                        }
 
 
                                                if (CONST_Debug) var_dump($sSQL);
                                                $aFilteredPlaceIDs = $this->oDB->getCol($sSQL);
                                                $tempIDs = array();
                                                if (CONST_Debug) var_dump($sSQL);
                                                $aFilteredPlaceIDs = $this->oDB->getCol($sSQL);
                                                $tempIDs = array();
-                                               foreach($aFilteredPlaceIDs as $placeID){
-                                                       $tempIDs[$placeID]= $aResultPlaceIDs[$placeID];  //assign housenumber to placeID
+                                               foreach($aFilteredPlaceIDs as $placeID)
+                        {
+                                                       $tempIDs[$placeID] = $aResultPlaceIDs[$placeID];  //assign housenumber to placeID
                                                }
                                                }
-                                               $aResultPlaceIDs=$tempIDs;
+                                               $aResultPlaceIDs = $tempIDs;
                                        }
 
                                        //exit;
                                        }
 
                                        //exit;