3 require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
4 require_once(CONST_BasePath.'/lib/init-website.php');
5 require_once(CONST_BasePath.'/lib/log.php');
6 require_once(CONST_BasePath.'/lib/output.php');
7 ini_set('memory_limit', '200M');
9 $oParams = new Nominatim\ParameterParser();
11 $sOutputFormat = 'html';
12 $iDays = $oParams->getInt('days', 1);
13 $bReduced = $oParams->getBool('reduced', false);
14 $sClass = $oParams->getString('class', false);
18 $iTotalBroken = (int) chksql($oDB->getOne('select count(*) from import_polygon_error'));
21 while ($iTotalBroken && !sizeof($aPolygons)) {
22 $sSQL = 'select osm_type as "type",osm_id as "id",class as "key",type as "value",name->\'name\' as "name",';
23 $sSQL .= 'country_code as "country",errormessage as "error message",updated';
24 $sSQL .= " from import_polygon_error";
25 $sSQL .= " where updated > 'now'::timestamp - '".$iDays." day'::interval";
28 if ($bReduced) $sSQL .= " and errormessage like 'Area reduced%'";
29 if ($sClass) $sSQL .= " and class = '".pg_escape_string($sClass)."'";
30 $sSQL .= " order by updated desc limit 1000";
31 $aPolygons = chksql($oDB->getAll($sSQL));
43 <meta charset="utf-8"/>
44 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
46 <title>Nominatim Broken Polygon Data</title>
48 <meta name="description" content="List of broken OSM polygon data by date" lang="en-US" />
53 <style type="text/css">
59 border-collapse: collapse;
60 background-color: white;
68 border-left-color: #ddd;
69 border-right-color: #ddd;
70 background-color: #eee;
71 -moz-border-radius: 0px 0px 0px 0px;
78 border-left-color: #ddd;
79 border-right-color: #ddd;
80 background-color: white;
81 -moz-border-radius: 0px 0px 0px 0px;
87 echo "<p>Total number of broken polygons: $iTotalBroken</p>";
88 if (!$aPolygons) exit;
91 //var_dump($aPolygons[0]);
92 foreach ($aPolygons[0] as $sCol => $sVal) {
93 echo "<th>".$sCol."</th>";
95 echo "<th> </th>";
96 echo "<th> </th>";
99 foreach ($aPolygons as $aRow) {
100 if (isset($aSeen[$aRow['type'].$aRow['id']])) continue;
101 $aSeen[$aRow['type'].$aRow['id']] = 1;
103 foreach ($aRow as $sCol => $sVal) {
105 case 'error message':
106 if (preg_match('/Self-intersection\\[([0-9.\\-]+) ([0-9.\\-]+)\\]/', $sVal, $aMatch)) {
107 $aRow['lat'] = $aMatch[2];
108 $aRow['lon'] = $aMatch[1];
109 echo "<td><a href=\"http://www.openstreetmap.org/?lat=".$aMatch[2]."&lon=".$aMatch[1]."&zoom=18&layers=M&".$sOSMType."=".$aRow['id']."\">".($sVal?$sVal:' ')."</a></td>";
111 echo "<td>".($sVal?$sVal:' ')."</td>";
115 echo '<td>'.osmLink($aRow).'</td>';
118 echo "<td>".($sVal?$sVal:' ')."</td>";
122 echo "<td><a href=\"http://localhost:8111/import?url=http://www.openstreetmap.org/api/0.6/".$sOSMType.'/'.$aRow['id']."/full\" target=\"josm\">josm</a></td>";
123 if (isset($aRow['lat'])) {
124 echo "<td><a href=\"http://open.mapquestapi.com/dataedit/index_flash.html?lat=".$aRow['lat']."&lon=".$aRow['lon']."&zoom=18\" target=\"potlatch2\">P2</a></td>";
126 echo "<td> </td>";