2 require_once(dirname(dirname(__FILE__)).'/lib/init-website.php');
3 require_once(CONST_BasePath.'/lib/log.php');
5 $sOutputFormat = 'html';
6 ini_set('memory_limit', '200M');
9 if (!isset($_GET['days'])) $_GET['days'] = 1;
11 if (isset($_GET['reduced'])) $bReduced = true;
13 if (isset($_GET['class'])) $sClass = $_GET['class'];
16 while(!sizeof($aPolygons))
18 $sSQL = 'select osm_type as "type",osm_id as "id",class as "key",type as "value",name->\'name\' as "name",';
19 $sSQL .= 'country_code as "country",errormessage as "error message",updated';
20 $sSQL .= " from import_polygon_error";
23 $sSQL .= " where updated > 'now'::timestamp - '".(int)$_GET['days']." day'::interval";
28 $sSQL .= " and errormessage like 'Area reduced%'";
32 $sSQL .= " and class = '".pg_escape_string($sClass)."'";
34 $sSQL .= " order by updated desc limit 1000";
35 $aPolygons = $oDB->getAll($sSQL);
37 //var_dump($aPolygons);
42 <meta charset="utf-8"/>
43 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
45 <title>Nominatim Broken Polygon Data</title>
47 <meta name="description" content="List of broken OSM polygon data by date" lang="en-US" />
52 <style type="text/css">
58 border-collapse: collapse;
59 background-color: white;
67 border-left-color: #ddd;
68 border-right-color: #ddd;
69 background-color: #eee;
70 -moz-border-radius: 0px 0px 0px 0px;
77 border-left-color: #ddd;
78 border-right-color: #ddd;
79 background-color: white;
80 -moz-border-radius: 0px 0px 0px 0px;
88 //var_dump($aPolygons[0]);
89 foreach($aPolygons[0] as $sCol => $sVal)
91 echo "<th>".$sCol."</th>";
93 echo "<th> </th>";
94 echo "<th> </th>";
97 foreach($aPolygons as $aRow)
99 if (isset($aSeen[$aRow['type'].$aRow['id']])) continue;
100 $aSeen[$aRow['type'].$aRow['id']] = 1;
102 foreach($aRow as $sCol => $sVal)
106 case 'error message':
107 if (preg_match('/Self-intersection\\[([0-9.\\-]+) ([0-9.\\-]+)\\]/',$sVal,$aMatch))
109 $aRow['lat'] = $aMatch[2];
110 $aRow['lon'] = $aMatch[1];
111 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>";
115 echo "<td>".($sVal?$sVal:' ')."</td>";
119 $sOSMType = ($aRow['type'] == 'N'?'node':($aRow['type'] == 'W'?'way':($aRow['type'] == 'R'?'relation':'')));
120 echo '<td><a href="http://www.openstreetmap.org/browse/'.$sOSMType.'/'.$aRow['id'].'" target="_new">'.$aRow['id'].'</a></td>';
123 echo "<td>".($sVal?$sVal:' ')."</td>";
127 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>";
128 if (isset($aRow['lat']))
130 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>";
134 echo "<td> </td>";
142 // include(CONST_BasePath.'/lib/template/details-'.$sOutputFormat.'.php');