]> git.openstreetmap.org Git - nominatim.git/blob - lib/template/polygons-html.php
Merge pull request #1745 from lonvia/shuffle-sql-functions
[nominatim.git] / lib / template / polygons-html.php
1 <?php
2     header("content-type: text/html; charset=UTF-8");
3     include(CONST_BasePath.'/lib/template/includes/html-header.php');
4 ?>
5     <title>Nominatim Broken Polygon Data</title>    
6     <meta name="description" content="List of broken OSM polygon data by date" lang="en-US" />
7 </head>
8
9 <body>
10
11 <div class="container">
12     <h1>Broken polygons</h1>
13
14     <p>
15         Total number of broken polygons: <?php echo $iTotalBroken ?>.
16         Also available in <a href="<?php echo CONST_Website_BaseURL; ?>polygons.php?format=json">JSON format</a>.
17     </p>
18
19     <table class="table table-striped table-hover">
20
21 <?php
22 if (!empty($aPolygons)) {
23
24     echo '<tr>';
25     //var_dump($aPolygons[0]);
26     foreach (array_keys($aPolygons[0]) as $sCol) {
27         echo '<th>'.$sCol.'</th>';
28     }
29     echo '<th>&nbsp;</th>';
30     echo '</tr>';
31     $aSeen = array();
32     foreach ($aPolygons as $aRow) {
33         if (isset($aSeen[$aRow['osm_type'].$aRow['osm_id']])) continue;
34         $aSeen[$aRow['osm_type'].$aRow['osm_id']] = 1;
35
36         echo '<tr>';
37         $sOSMType = formatOSMType($aRow['osm_type']);
38         foreach ($aRow as $sCol => $sVal) {
39             switch ($sCol) {
40                 case 'errormessage':
41                     if (preg_match('/Self-intersection\\[([0-9.\\-]+) ([0-9.\\-]+)\\]/', $sVal, $aMatch)) {
42                         $aRow['lat'] = $aMatch[2];
43                         $aRow['lon'] = $aMatch[1];
44                         $sUrl = sprintf('https://www.openstreetmap.org/?lat=%f&lon=%f&zoom=18&layers=M&%s=%d',
45                                 $aRow['lat'],
46                                 $aRow['lon'],
47                                 $sOSMType,
48                                 $aRow['osm_id']);
49                         echo '<td><a href="'.$sUrl.'">'.($sVal?$sVal:'&nbsp;').'</a></td>';
50                     } else {
51                         echo '<td>'.($sVal?$sVal:'&nbsp;').'</td>';
52                     }
53                     break;
54                 case 'osm_id':
55                     echo '<td>'.osmLink(array('osm_type' => $aRow['osm_type'], 'osm_id' => $aRow['osm_id'])).'</td>';
56                     break;
57                 default:
58                     echo '<td>'.($sVal?$sVal:'&nbsp;').'</td>';
59                     break;
60             }
61         }
62         $sJosmUrl = 'http://localhost:8111/import?url=https://www.openstreetmap.org/api/0.6/'.$sOSMType.'/'.$aRow['osm_id'].'/full';
63         echo '<td><a href="'.$sJosmUrl.'" target="josm">josm</a></td>';
64         echo '</tr>';
65     }
66     echo '</table>';
67 }
68 ?>
69 </div>
70 </body>
71 </html>