]> git.openstreetmap.org Git - nominatim.git/blob - lib/template/details-error-html.php
unify address details lookup
[nominatim.git] / lib / template / details-error-html.php
1 <?php
2     header("content-type: text/html; charset=UTF-8");
3 ?>
4 <?php include(CONST_BasePath.'/lib/template/includes/html-header.php'); ?>
5     <link href="css/common.css" rel="stylesheet" type="text/css" />
6     <link href="css/details.css" rel="stylesheet" type="text/css" />
7 </head>
8
9
10 <?php
11
12     function osmMapUrl($aFeature)
13     {
14         if (isset($sFeature['error_x']) && isset($sFeature['error_y']))
15         {
16             $sBaseUrl = '//www.openstreetmap.org/';
17             $sOSMType = formatOSMType($aFeature['osm_type'], false);
18             if ($sOSMType)
19             {
20                 $sBaseUrl += $sOSMType.'/'.$aFeature['osm_id'];
21             }
22
23             return '<a href="'.$sBaseUrl.'?mlat='.$aFeature['error_y'].'&mlon='.$aFeature['error_x'].'">view on osm.org</a>';
24         }
25         return '';
26     }
27
28     function josm_edit_url($aFeature)
29     {
30         $fWidth = 0.0002;
31         $sLon = $aFeature['error_x'];
32         $sLat = $aFeature['error_y'];
33
34         if (isset($sLat))
35         {
36             return "http://localhost:8111/load_and_zoom?left=".($sLon-$fWidth)."&right=".($sLon+$fWidth)."&top=".($sLat+$fWidth)."&bottom=".($sLat-$fWidth);
37         }
38
39         $sOSMType = formatOSMType($aFeature['osm_type'], false);
40         if ($sOSMType)
41         {
42             return 'http://localhost:8111/import?url=http://www.openstreetmap.org/api/0.6/'.$sOSMType.'/'.$aFeature['osm_id'].'/full';
43             // Should be better to load by object id - but this doesn't seem to zoom correctly
44             // return " <a href=\"http://localhost:8111/load_object?new_layer=true&objects=".strtolower($aFeature['osm_type']).$sOSMID."\" target=\"josm\">Remote Control (JOSM / Merkaartor)</a>";
45         }
46         return '';
47     }
48
49     function potlach_edit_url($aFeature)
50     {
51         $fWidth = 0.0002;
52         $sLat = $aFeature['error_y'];
53         $sLon = $aFeature['error_x'];
54
55         if (isset($sLat))
56         {
57             return "//www.openstreetmap.org/edit?editor=potlatch2&bbox=".($sLon-$fWidth).",".($sLat-$fWidth).",".($sLon+$fWidth).",".($sLat+$fWidth);
58         }
59         return '';
60     }
61
62
63
64 ?>
65
66 <body id="details-page">
67     <div class="container">
68         <div class="row">
69             <div class="col-md-6">
70
71
72                 <h1><?php echo $aPointDetails['localname'] ?></h1>
73                 <div class="locationdetails">
74                     <h2 class="bg-danger">This object has an invalid geometry.</h2>
75
76                     <div>
77                         Type: <span class="type"><?php echo $aPointDetails['class'].':'.$aPointDetails['type'];?></span>
78                     </div>
79
80                     <div>
81                         OSM: <span class="label"><?php echo osmLink($aPointDetails); ?><span>
82                     </div>
83
84
85                     <h4>Error</h4>
86                     <p>
87                         <?php echo $aPointDetails['errormessage']?$aPointDetails['errormessage']:'unknown'; ?>
88                     </p>
89                     <?php echo osmMapUrl($aPointDetails); ?>
90
91                     <h4>Edit</h4>
92                     <ul>
93                     <?php if (josm_edit_url($aPointDetails)) { ?>
94                             <li><a href="<?php echo josm_edit_url($aPointDetails); ?>" target="josm">Remote Control (JOSM / Merkaartor)</a></li>
95                     <?php } ?>
96                     <?php if (potlach_edit_url($aPointDetails)) { ?>
97                             <li><a href="<?php echo potlach_edit_url($aPointDetails); ?>" target="potlatch2">Potlatch 2</a></li>
98                     <?php } ?>
99                     </ul>
100             </div>
101         </div>
102         <div class="col-md-6">
103             <div id="map"></div>
104         </div>
105
106     </div>
107
108
109     <script type="text/javascript">
110
111         var nominatim_result = {
112             outlinestring: '<?php echo $aPointDetails['outlinestring'];?>',
113             lon: <?php echo isset($aPointDetails['error_x']) ? $aPointDetails['error_x'] : 0; ?>,
114             lat: <?php echo isset($aPointDetails['error_y']) ? $aPointDetails['error_y'] : 0; ?>
115         };
116
117     </script>
118
119
120     <?php include(CONST_BasePath.'/lib/template/includes/html-footer.php'); ?>
121     </body>
122 </html>