]> git.openstreetmap.org Git - nominatim.git/commitdiff
Update details.php to show linked places
authorBrian Quinion <openstreetmap@brian.quinion.co.uk>
Sun, 1 Apr 2012 01:38:40 +0000 (02:38 +0100)
committerBrian Quinion <openstreetmap@brian.quinion.co.uk>
Sun, 1 Apr 2012 01:38:40 +0000 (02:38 +0100)
lib/template/details-html.php
sql/functions.sql
website/details.php
website/search.php

index aa27664b307eed944e45637673a589c788d63b34..c438659b6e7f107854389b37f65a5ed1f2966739 100644 (file)
@@ -142,7 +142,7 @@ if (isset($aPolyPoints))
                if ($sOSMType) echo ', <span class="osm"><span class="label"></span>'.$sOSMType.' <a href="http://www.openstreetmap.org/browse/'.$sOSMType.'/'.$aAddressLine['osm_id'].'">'.$aAddressLine['osm_id'].'</a></span>';
                echo ', <span class="adminlevel">'.$aAddressLine['admin_level'].'</span>';
                echo ', <span class="rankaddress">'.$aAddressLine['rank_search_label'].'</span>';
-               echo ', <span class="area">'.($aAddressLine['fromarea']=='t'?'Polygon':'Point').'</span>';
+//             echo ', <span class="area">'.($aAddressLine['fromarea']=='t'?'Polygon':'Point').'</span>';
                echo ', <span class="distance">'.$aAddressLine['distance'].'</span>';
                echo ' <a href="details.php?place_id='.$aAddressLine['place_id'].'">GOTO</a>';
                echo ')';
@@ -150,6 +150,30 @@ if (isset($aPolyPoints))
        }
        echo '</div>';
 
+       if ($aLinkedLines)
+       {
+               echo '<h2>Linked Places</h2>';
+               echo '<div class=\"linked\">';
+               foreach($aLinkedLines as $aAddressLine)
+               {       
+                       $sOSMType = ($aAddressLine['osm_type'] == 'N'?'node':($aAddressLine['osm_type'] == 'W'?'way':($aAddressLine['osm_type'] == 'R'?'relation':'')));
+
+                       echo '<div class="line">';
+                       echo '<span class="name">'.(trim($aAddressLine['localname'])?$aAddressLine['localname']:'<span class="noname">No Name</span>').'</span>';
+                       echo ' (';
+                       echo '<span class="type"><span class="label">Type: </span>'.$aAddressLine['class'].':'.$aAddressLine['type'].'</span>';
+                       if ($sOSMType) echo ', <span class="osm"><span class="label"></span>'.$sOSMType.' <a href="http://www.openstreetmap.org/browse/'.$sOSMType.'/'.$aAddressLine['osm_id'].'">'.$aAddressLine['osm_id'].'</a></span>';
+                       echo ', <span class="adminlevel">'.$aAddressLine['admin_level'].'</span>';
+                       echo ', <span class="rankaddress">'.$aAddressLine['rank_search_label'].'</span>';
+//                     echo ', <span class="area">'.($aAddressLine['fromarea']=='t'?'Polygon':'Point').'</span>';
+                       echo ', <span class="distance">'.$aAddressLine['distance'].'</span>';
+                       echo ' <a href="details.php?place_id='.$aAddressLine['place_id'].'">GOTO</a>';
+                       echo ')';
+                       echo '</div>';
+               }
+               echo '</div>';
+       }
+
        if ($aPlaceSearchNameKeywords)
        {
                echo '<h2>Name Keywords</h2>';
index 0174387b2050afd417be782b2c2562b1ce6fd6af..c825712d69ce7d37158ff8aef4e09a3abc08ab55 100644 (file)
@@ -1481,7 +1481,6 @@ BEGIN
 
         -- mark the linked place (excludes from search results)
         UPDATE placex set linked_place_id = NEW.place_id where place_id = linkedPlacex.place_id;
-        DELETE from search_name where place_id = linkedPlacex.place_id;
 
       END LOOP;
 
@@ -1505,7 +1504,6 @@ BEGIN
 
           -- mark the linked place (excludes from search results)
           UPDATE placex set linked_place_id = NEW.place_id where place_id = linkedPlacex.place_id;
-          DELETE from search_name where place_id = linkedPlacex.place_id;
         END IF;
 
       END LOOP;
@@ -1534,12 +1532,12 @@ BEGIN
 
           -- mark the linked place (excludes from search results)
           UPDATE placex set linked_place_id = NEW.place_id where place_id = linkedPlacex.place_id;
-          DELETE from search_name where place_id = linkedPlacex.place_id;
+
         END LOOP;
       END IF;
 
       IF NEW.centroid IS NOT NULL THEN
-        place_centroid := NEW.centroid
+        place_centroid := NEW.centroid;
       END IF;
 
     END IF;
index a4cb8b960072e4fde4fa7124c2c3bbb6126cdfc2..7c6ad8ad4f17cc1428cc11afa7485698ec51b603 100755 (executable)
        // Address
        $aAddressLines = getAddressDetails($oDB, $sLanguagePrefArraySQL, $iPlaceID, $aPointDetails['country_code'], true);
 
+       // Linked places
+       $sSQL = "select placex.place_id, osm_type, osm_id, class, type, housenumber, admin_level, rank_address, ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon') as isarea, st_distance(geometry, placegeometry) as distance, ";
+       $sSQL .= " get_name_by_language(name,$sLanguagePrefArraySQL) as localname, length(name::text) as namelength ";
+       $sSQL .= " from placex, (select geometry as placegeometry from placex where place_id = $iPlaceID) as x";
+       $sSQL .= " where linked_place_id = $iPlaceID";
+       $sSQL .= " order by rank_address asc,rank_search asc,get_name_by_language(name,$sLanguagePrefArraySQL),housenumber";
+       $aLinkedLines = $oDB->getAll($sSQL);
+
        // All places this is an imediate parent of
        $sSQL = "select placex.place_id, osm_type, osm_id, class, type, housenumber, admin_level, rank_address, ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon') as isarea, st_distance(geometry, placegeometry) as distance, ";
        $sSQL .= " get_name_by_language(name,$sLanguagePrefArraySQL) as localname, length(name::text) as namelength ";
        $sSQL .= " from placex, (select geometry as placegeometry from placex where place_id = $iPlaceID) as x";
        $sSQL .= " where parent_place_id = $iPlaceID";
-//     $sSQL .= " and type != 'postcode'";
        $sSQL .= " order by rank_address asc,rank_search asc,get_name_by_language(name,$sLanguagePrefArraySQL),housenumber";
        $aParentOfLines = $oDB->getAll($sSQL);
 
index c00c4cfd3ac33389306ea0723830b4f420757f16..88248cea2484a191332073fc202ac30fa44606a7 100755 (executable)
                                        $sSQL .= "coalesce(importance,0.9-(rank_search::float/30)) as importance ";
                                        $sSQL .= "from placex where place_id in ($sPlaceIDs) ";
                                        $sSQL .= "and placex.rank_address between $iMinAddressRank and $iMaxAddressRank ";
+                                       $sSQL .= "and linked_place_id is null ";
                                        $sSQL .= "group by osm_type,osm_id,class,type,admin_level,rank_search,rank_address,country_code,importance";
                                        if (!$bDeDupe) $sSQL .= ",place_id";
                                        $sSQL .= ",get_address_by_language(place_id, $sLanguagePrefArraySQL) ";