2 require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
3 require_once(CONST_BasePath.'/lib/init-website.php');
4 require_once(CONST_BasePath.'/lib/log.php');
6 $sOutputFormat = 'html';
7 ini_set('memory_limit', '200M');
10 if (!isset($_GET['days'])) $_GET['days'] = 1;
12 if (isset($_GET['reduced'])) $bReduced = true;
14 if (isset($_GET['class'])) $sClass = $_GET['class'];
16 $iTotalBroken = (int) $oDB->getOne('select count(*) from import_polygon_error');
19 while($iTotalBroken && !sizeof($aPolygons))
21 $sSQL = 'select osm_type as "type",osm_id as "id",class as "key",type as "value",name->\'name\' as "name",';
22 $sSQL .= 'country_code as "country",errormessage as "error message",updated';
23 $sSQL .= " from import_polygon_error";
26 $sSQL .= " where updated > 'now'::timestamp - '".(int)$_GET['days']." day'::interval";
31 $sSQL .= " and errormessage like 'Area reduced%'";
35 $sSQL .= " and class = '".pg_escape_string($sClass)."'";
37 $sSQL .= " order by updated desc limit 1000";
38 $aPolygons = $oDB->getAll($sSQL);
40 //var_dump($aPolygons);
45 <meta charset="utf-8"/>
46 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
48 <title>Nominatim Broken Polygon Data</title>
50 <meta name="description" content="List of broken OSM polygon data by date" lang="en-US" />
55 <style type="text/css">
61 border-collapse: collapse;
62 background-color: white;
70 border-left-color: #ddd;
71 border-right-color: #ddd;
72 background-color: #eee;
73 -moz-border-radius: 0px 0px 0px 0px;
80 border-left-color: #ddd;
81 border-right-color: #ddd;
82 background-color: white;
83 -moz-border-radius: 0px 0px 0px 0px;
89 echo "<p>Total number of broken polygons: $iTotalBroken</p>";
92 //var_dump($aPolygons[0]);
93 foreach($aPolygons[0] as $sCol => $sVal)
95 echo "<th>".$sCol."</th>";
97 echo "<th> </th>";
98 echo "<th> </th>";
101 foreach($aPolygons as $aRow)
103 if (isset($aSeen[$aRow['type'].$aRow['id']])) continue;
104 $aSeen[$aRow['type'].$aRow['id']] = 1;
106 foreach($aRow as $sCol => $sVal)
110 case 'error message':
111 if (preg_match('/Self-intersection\\[([0-9.\\-]+) ([0-9.\\-]+)\\]/',$sVal,$aMatch))
113 $aRow['lat'] = $aMatch[2];
114 $aRow['lon'] = $aMatch[1];
115 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>";
119 echo "<td>".($sVal?$sVal:' ')."</td>";
123 $sOSMType = ($aRow['type'] == 'N'?'node':($aRow['type'] == 'W'?'way':($aRow['type'] == 'R'?'relation':'')));
124 echo '<td><a href="http://www.openstreetmap.org/browse/'.$sOSMType.'/'.$aRow['id'].'" target="_new">'.$aRow['id'].'</a></td>';
127 echo "<td>".($sVal?$sVal:' ')."</td>";
131 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>";
132 if (isset($aRow['lat']))
134 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>";
138 echo "<td> </td>";
146 // include(CONST_BasePath.'/lib/template/details-'.$sOutputFormat.'.php');