- $sSQL .= " AND 30 between $this->iMinAddressRank AND $this->iMaxAddressRank";
- $sSQL .= " ) AS blub"; //postgres wants an alias here
- $sSQL .= " GROUP BY";
- $sSQL .= " place_id, ";
- $sSQL .= " housenumber_for_place"; //is this group by really needed?, place_id + housenumber (in combination) are unique
- if (!$this->bDeDupe) $sSQL .= ", place_id ";
- }
- // osmline
- // interpolation line search only if a housenumber was searched and if it was found (i.e. aPlaceIDs[placeID] = housenumber != -1) (realized through a join)
- $sSQL .= " UNION ";
- $sSQL .= "SELECT ";
- $sSQL .= " 'W' AS osm_type, ";
- $sSQL .= " osm_id, ";
- $sSQL .= " 'place' AS class, ";
- $sSQL .= " 'house' AS type, ";
- $sSQL .= " null AS admin_level, ";
- $sSQL .= " 30 AS rank_search, ";
- $sSQL .= " 30 AS rank_address, ";
- $sSQL .= " min(place_id) as place_id, ";
- $sSQL .= " min(parent_place_id) AS parent_place_id, ";
- $sSQL .= " country_code, ";
- $sSQL .= " get_address_by_language(place_id, housenumber_for_place, $sLanguagePrefArraySQL) AS langaddress, ";
- $sSQL .= " null AS placename, ";
- $sSQL .= " null AS ref, ";
- if ($this->bIncludeExtraTags) $sSQL .= "null AS extra, ";
- if ($this->bIncludeNameDetails) $sSQL .= "null AS names, ";
- $sSQL .= " AVG(st_x(centroid)) AS lon, ";
- $sSQL .= " AVG(st_y(centroid)) AS lat, ";
- $sSQL .= " -0.1".$sImportanceSQL." AS importance, "; // slightly smaller than the importance for normal houses with rank 30, which is 0
- if ($oCtx->hasNearPoint()) {
- $sSQL .= $oCtx->distanceSQL('ST_Collect(centroid)')." AS addressimportance,";