From a5d5a9230436d6a8b053d0c89e24a869bb7baf02 Mon Sep 17 00:00:00 2001 From: Brian Quinion Date: Mon, 5 Nov 2012 14:00:54 +0000 Subject: [PATCH] include a bit of extra details for polygon errors in output on details.php page --- sql/tables.sql | 1 + website/details.php | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/sql/tables.sql b/sql/tables.sql index d5cf7bcd..8f933abc 100644 --- a/sql/tables.sql +++ b/sql/tables.sql @@ -216,6 +216,7 @@ CREATE INDEX idx_placex_adminname on placex USING BTREE (make_standard_name(name DROP SEQUENCE seq_place; CREATE SEQUENCE seq_place start 1; +GRANT SELECT on place to "www-data" ; GRANT SELECT on placex to "www-data" ; GRANT UPDATE ON placex to "www-data" ; GRANT SELECT ON search_name to "www-data" ; diff --git a/website/details.php b/website/details.php index b7a38b2d..c92e3f77 100755 --- a/website/details.php +++ b/website/details.php @@ -18,6 +18,17 @@ 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'])) -- 2.39.5