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');
5 ini_set('memory_limit', '200M');
9 $sOutputFormat = 'html';
10 $iDays = getParamInt('days', 1);
11 $bReduced = getParamBool('reduced', false);
12 $sClass = getParamString('class', false);
14 $iTotalBroken = (int) $oDB->getOne('select count(*) from import_polygon_error');
17 while($iTotalBroken && !sizeof($aPolygons))
19 $sSQL = 'select osm_type as "type",osm_id as "id",class as "key",type as "value",name->\'name\' as "name",';
20 $sSQL .= 'country_code as "country",errormessage as "error message",updated';
21 $sSQL .= " from import_polygon_error";
22 $sSQL .= " where updated > 'now'::timestamp - '".$iDays." day'::interval";
25 if ($bReduced) $sSQL .= " and errormessage like 'Area reduced%'";
26 if ($sClass) $sSQL .= " and class = '".pg_escape_string($sClass)."'";
27 $sSQL .= " order by updated desc limit 1000";
28 $aPolygons = $oDB->getAll($sSQL);
30 //var_dump($aPolygons);
35 <meta charset="utf-8"/>
36 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
38 <title>Nominatim Broken Polygon Data</title>
40 <meta name="description" content="List of broken OSM polygon data by date" lang="en-US" />
45 <style type="text/css">
51 border-collapse: collapse;
52 background-color: white;
60 border-left-color: #ddd;
61 border-right-color: #ddd;
62 background-color: #eee;
63 -moz-border-radius: 0px 0px 0px 0px;
70 border-left-color: #ddd;
71 border-right-color: #ddd;
72 background-color: white;
73 -moz-border-radius: 0px 0px 0px 0px;
79 echo "<p>Total number of broken polygons: $iTotalBroken</p>";
82 //var_dump($aPolygons[0]);
83 foreach($aPolygons[0] as $sCol => $sVal)
85 echo "<th>".$sCol."</th>";
87 echo "<th> </th>";
88 echo "<th> </th>";
91 foreach($aPolygons as $aRow)
93 if (isset($aSeen[$aRow['type'].$aRow['id']])) continue;
94 $aSeen[$aRow['type'].$aRow['id']] = 1;
96 foreach($aRow as $sCol => $sVal)
100 case 'error message':
101 if (preg_match('/Self-intersection\\[([0-9.\\-]+) ([0-9.\\-]+)\\]/',$sVal,$aMatch))
103 $aRow['lat'] = $aMatch[2];
104 $aRow['lon'] = $aMatch[1];
105 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>";
109 echo "<td>".($sVal?$sVal:' ')."</td>";
113 $sOSMType = ($aRow['type'] == 'N'?'node':($aRow['type'] == 'W'?'way':($aRow['type'] == 'R'?'relation':'')));
114 echo '<td><a href="http://www.openstreetmap.org/'.$sOSMType.'/'.$aRow['id'].'" target="_new">'.$aRow['id'].'</a></td>';
117 echo "<td>".($sVal?$sVal:' ')."</td>";
121 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>";
122 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>";
128 echo "<td> </td>";
136 // include(CONST_BasePath.'/lib/template/details-'.$sOutputFormat.'.php');