]> git.openstreetmap.org Git - nominatim.git/blobdiff - website/details.php
limit polygon output to one type as a time
[nominatim.git] / website / details.php
index b7a38b2d7cc7c1cea3c000835de8e68b8393475a..c92e3f77ce3849b3d7b9206a8dc52f57bcee793c 100755 (executable)
        if (isset($_GET['osmtype']) && isset($_GET['osmid']) && (int)$_GET['osmid'] && ($_GET['osmtype'] == 'N' || $_GET['osmtype'] == 'W' || $_GET['osmtype'] == 'R'))
        {
                $_GET['place_id'] = $oDB->getOne("select place_id from placex where osm_type = '".$_GET['osmtype']."' and osm_id = ".(int)$_GET['osmid']." order by type = 'postcode' asc");
+
+               // Be nice about our error messages for broken geometry
+               if (!$_GET['place_id'])
+               {
+                       $sErrorMessage = $oDB->getOne("select ST_IsValidReason(geometry) from place where osm_type = '".$_GET['osmtype']."' and osm_id = ".(int)$_GET['osmid']." order by type = 'postcode' asc");
+                       if (!PEAR::isError($sErrorMessage) && $sErrorMessage) {
+                               echo "Problem with geometry: ";
+                               echo $sErrorMessage;
+                               exit;
+                       }
+               }
        }
 
        if (!isset($_GET['place_id']))