-$sSQL = 'SELECT obj.place_id, osm_type, osm_id, class, type, housenumber,';
-$sSQL .= " admin_level, rank_address, ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon') AS isarea,";
-$sSQL .= " ST_DistanceSpheroid(geometry, placegeometry, 'SPHEROID[\"WGS 84\",6378137,298.257223563, AUTHORITY[\"EPSG\",\"7030\"]]') AS distance, ";
-$sSQL .= " get_name_by_language(name,$sLanguagePrefArraySQL) AS localname, ";
-$sSQL .= ' length(name::text) AS namelength ';
-$sSQL .= ' FROM ';
-$sSQL .= ' ( ';
-$sSQL .= ' SELECT placex.place_id, osm_type, osm_id, class, type, housenumber, admin_level, rank_address, rank_search, geometry, name ';
-$sSQL .= ' FROM placex ';
-$sSQL .= " WHERE parent_place_id = $iPlaceID ";
-$sSQL .= ' ORDER BY ';
-$sSQL .= ' rank_address ASC, ';
-$sSQL .= ' rank_search ASC ';
-$sSQL .= ' LIMIT 500 ';
-$sSQL .= ' ) AS obj,';
-$sSQL .= ' ( ';
-$sSQL .= ' SELECT centroid AS placegeometry ';
-$sSQL .= ' FROM placex ';
-$sSQL .= " WHERE place_id = $iPlaceID ";
-$sSQL .= ' ) AS x';
-$sSQL .= ' ORDER BY ';
-$sSQL .= ' rank_address ASC, ';
-$sSQL .= ' rank_search ASC, ';
-$sSQL .= ' localname, ';
-$sSQL .= ' housenumber';
-$aParentOfLines = $oDB->getAll($sSQL);
-if (PEAR::isError($aParentOfLines)) { // possible timeout
- $aParentOfLines = [];
+$aHierarchyLines = false;
+if ($bIncludeHierarchy) {
+ $sSQL = 'SELECT obj.place_id, osm_type, osm_id, class, type, housenumber,';
+ $sSQL .= " admin_level, rank_address, ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon') AS isarea,";
+ $sSQL .= " ST_DistanceSpheroid(geometry, placegeometry, 'SPHEROID[\"WGS 84\",6378137,298.257223563, AUTHORITY[\"EPSG\",\"7030\"]]') AS distance, ";
+ $sSQL .= " get_name_by_language(name,$sLanguagePrefArraySQL) AS localname, ";
+ $sSQL .= ' length(name::text) AS namelength ';
+ $sSQL .= ' FROM ';
+ $sSQL .= ' ( ';
+ $sSQL .= ' SELECT placex.place_id, osm_type, osm_id, class, type, housenumber, admin_level, rank_address, rank_search, geometry, name ';
+ $sSQL .= ' FROM placex ';
+ $sSQL .= " WHERE parent_place_id = $iPlaceID ";
+ $sSQL .= ' ORDER BY ';
+ $sSQL .= ' rank_address ASC, ';
+ $sSQL .= ' rank_search ASC ';
+ $sSQL .= ' LIMIT 500 ';
+ $sSQL .= ' ) AS obj,';
+ $sSQL .= ' ( ';
+ $sSQL .= ' SELECT centroid AS placegeometry ';
+ $sSQL .= ' FROM placex ';
+ $sSQL .= " WHERE place_id = $iPlaceID ";
+ $sSQL .= ' ) AS x';
+ $sSQL .= ' ORDER BY ';
+ $sSQL .= ' rank_address ASC, ';
+ $sSQL .= ' rank_search ASC, ';
+ $sSQL .= ' localname, ';
+ $sSQL .= ' housenumber';
+ $aHierarchyLines = $oDB->getAll($sSQL);
+ if (PEAR::isError($aHierarchyLines)) { // possible timeout
+ $aHierarchyLines = array();
+ }