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