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 require_once(CONST_BasePath.'/lib/output.php');
6 ini_set('memory_limit', '200M');
10 $sOutputFormat = 'html';
11 $iDays = getParamInt('days', 1);
12 $bReduced = getParamBool('reduced', false);
13 $sClass = getParamString('class', false);
15 $iTotalBroken = (int) $oDB->getOne('select count(*) from import_polygon_error');
18 while($iTotalBroken && !sizeof($aPolygons))
20 $sSQL = 'select osm_type as "type",osm_id as "id",class as "key",type as "value",name->\'name\' as "name",';
21 $sSQL .= 'country_code as "country",errormessage as "error message",updated';
22 $sSQL .= " from import_polygon_error";
23 $sSQL .= " where updated > 'now'::timestamp - '".$iDays." day'::interval";
26 if ($bReduced) $sSQL .= " and errormessage like 'Area reduced%'";
27 if ($sClass) $sSQL .= " and class = '".pg_escape_string($sClass)."'";
28 $sSQL .= " order by updated desc limit 1000";
29 $aPolygons = $oDB->getAll($sSQL);
31 //var_dump($aPolygons);
36 <meta charset="utf-8"/>
37 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
39 <title>Nominatim Broken Polygon Data</title>
41 <meta name="description" content="List of broken OSM polygon data by date" lang="en-US" />
46 <style type="text/css">
52 border-collapse: collapse;
53 background-color: white;
61 border-left-color: #ddd;
62 border-right-color: #ddd;
63 background-color: #eee;
64 -moz-border-radius: 0px 0px 0px 0px;
71 border-left-color: #ddd;
72 border-right-color: #ddd;
73 background-color: white;
74 -moz-border-radius: 0px 0px 0px 0px;
80 echo "<p>Total number of broken polygons: $iTotalBroken</p>";
81 if (!$aPolygons) exit;
84 //var_dump($aPolygons[0]);
85 foreach($aPolygons[0] as $sCol => $sVal)
87 echo "<th>".$sCol."</th>";
89 echo "<th> </th>";
90 echo "<th> </th>";
93 foreach($aPolygons as $aRow)
95 if (isset($aSeen[$aRow['type'].$aRow['id']])) continue;
96 $aSeen[$aRow['type'].$aRow['id']] = 1;
98 foreach($aRow as $sCol => $sVal)
102 case 'error message':
103 if (preg_match('/Self-intersection\\[([0-9.\\-]+) ([0-9.\\-]+)\\]/',$sVal,$aMatch))
105 $aRow['lat'] = $aMatch[2];
106 $aRow['lon'] = $aMatch[1];
107 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']))
125 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>";
129 echo "<td> </td>";