]> git.openstreetmap.org Git - nominatim.git/blob - lib/template/details-error-html.php
include edit links for errors
[nominatim.git] / lib / template / details-error-html.php
1 <?php
2         header("content-type: text/html; charset=UTF-8");
3 ?>
4 <html>
5   <head>
6     <title>OpenStreetMap Nominatim: <?php echo $aPointDetails['localname'];?></title>
7     <style>
8 body {
9         margin:0px;
10         padding:16px;
11   background:#ffffff;
12   height: 100%;
13   font: normal 12px/15px arial,sans-serif;
14 }
15 .line{
16   margin-left:20px;
17 }
18 .name{
19   font-weight: bold;
20 }
21 .notused{
22   color:#ddd;
23 }
24 .noname{
25   color:#800;
26 }
27 #map {
28   width:500px;
29   height:500px;
30   border: 2px solid #666;
31   float: right;
32 }
33     </style>
34         <script src="js/OpenLayers.js"></script>
35         <script src="js/tiles.js"></script>
36         <script type="text/javascript">
37         
38                 var map;
39
40     function init() {
41                         map = new OpenLayers.Map ("map", {
42                 controls:[
43                                                                                 new OpenLayers.Control.Permalink(),
44                                                                                 new OpenLayers.Control.Navigation(),
45                                                                                 new OpenLayers.Control.PanZoomBar(),
46                                                                                 new OpenLayers.Control.MouseDefaults(),
47                                                                                 new OpenLayers.Control.MousePosition(),
48                                                                                 new OpenLayers.Control.Attribution()],
49                 maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
50                 maxResolution: 156543.0399,
51                 numZoomLevels: 19,
52                 units: 'm',
53                 projection: new OpenLayers.Projection("EPSG:900913"),
54                 displayProjection: new OpenLayers.Projection("EPSG:4326")
55                 } );
56                         map.addLayer(new OpenLayers.Layer.OSM.<?php echo CONST_Tile_Default;?>("Default",
57                         { attribution : '© <a target="_parent" href="http://www.openstreetmap.org">OpenStreetMap</a> and contributors, under an <a target="_parent" href="http://www.openstreetmap.org/copyright">open license</a>'}));
58
59                         var layer_style = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);
60                         layer_style.fillOpacity = 0.2;
61                         layer_style.graphicOpacity = 0.2;
62
63                         vectorLayer = new OpenLayers.Layer.Vector("Points", {style: layer_style});
64                         map.addLayer(vectorLayer);
65
66             var proj_EPSG4326 = new OpenLayers.Projection("EPSG:4326");
67                         var proj_map = map.getProjectionObject();
68
69             freader = new OpenLayers.Format.WKT({
70                 'internalProjection': proj_map,
71                 'externalProjection': proj_EPSG4326
72             });
73
74             var bounds;
75             <?php if ($aPointDetails['prevgeom']) { ?>
76             var feature = freader.read('<?php echo $aPointDetails['prevgeom'];?>');
77             if (feature) {
78                 bounds = feature.geometry.getBounds();
79
80             }
81             feature.style = {
82                                 strokeColor: "#777777",
83                                 fillColor: "#F0F0F0",
84                                 strokeWidth: 2,
85                                 strokeOpacity: 0.75,
86                                 fillOpacity: 0.75,
87                 strokeDashstyle: "longdash"
88                         };
89             vectorLayer.addFeatures([feature]);
90             <?php } ?>
91
92             <?php if ($aPointDetails['newgeom']) { ?>
93             feature = freader.read('<?php echo $aPointDetails['newgeom'];?>');
94             if (feature) {
95                 if (!bounds) {
96                     bounds = feature.geometry.getBounds();
97                 } 
98                 else 
99                 {
100                     bounds.extend(feature.geometry.getBounds());
101                 }
102             }
103             feature.style = {
104                                 strokeColor: "#75ADFF",
105                                 fillColor: "#FFF7F0",
106                                 strokeWidth: 2,
107                                 strokeOpacity: 0.75,
108                                 fillOpacity: 0.75
109                         };
110             vectorLayer.addFeatures([feature]);
111             <?php } ?>
112
113             <?php if (isset($aPointDetails['error_x'])) { ?>
114             var pt = new OpenLayers.Geometry.Point(<?php echo $aPointDetails['error_x'].','.$aPointDetails['error_y'];?>);
115             pt = pt.transform(proj_EPSG4326, proj_map);
116             feature = new OpenLayers.Feature.Vector(pt, null,
117                        {
118                             graphicName : "x",
119                             fillColor: "#FF0000",
120                             graphic : true,
121                             pointRadius: 6
122                        });
123             vectorLayer.addFeatures([feature]);
124             <?php } ?>
125
126
127             map.zoomToExtent(bounds);
128
129                 }
130                 
131         </script>
132   </head>
133   <body onload="init();">
134     <div id="map"></div>
135         <h1><?php echo $aPointDetails['localname'] ?></h1>
136         <div class="locationdetails">
137         <div>Type: <span class="type"><?php echo $aPointDetails['class'].':'.$aPointDetails['type'];?></span></div>
138  
139 <?php
140     $sOSMType = ($aPointDetails['osm_type'] == 'N'?'node':($aPointDetails['osm_type'] == 'W'?'way':   ($aPointDetails['osm_type'] == 'R'?'relation':'')));
141     if ($sOSMType) echo ' <div>OSM: <span class="osm"><span class="label"></span>'.$sOSMType.' <a     href="http://www.openstreetmap.org/browse/'.$sOSMType.'/'.$aPointDetails['osm_id'].'">'.              $aPointDetails['osm_id'].'</a></span></div>';
142 ?>
143
144     <p>This object has an invalid geometry.</p>
145     <p><b>Details:</b> <?php
146
147 $sVal = $aPointDetails['errormessage'];
148 $sOSMType = ($aPointDetails['osm_type'] == 'N'?'node':($aPointDetails['osm_type'] == 'W'?'way':($aPointDetails['osm_type'] == 'R'?'relation':'')));
149 $sOSMID = $aPointDetails['osm_id'];
150
151 $bHaveLatLng = false;
152 if (preg_match('/Self-intersection\\[([0-9.\\-]+) ([0-9.\\-]+)\\]/',$sVal,$aMatch))
153 {
154         $sLat = $aMatch[2];
155         $sLon = $aMatch[1];
156         $bHaveLatLng = true;
157         echo "<a href=\"http://www.openstreetmap.org/?lat=".$sLat."&lon=".$sLon."&zoom=18&layers=M&".$sOSMType."=".$sOSMID."\">".($sVal?$sVal:'&nbsp;')."</a>";
158 }
159 else
160 {
161         echo ($sVal?$sVal:'&nbsp;');
162 }
163 ?>
164     <p><b>Edit:</b> in <?php
165 if ($bHaveLatLng)
166 {
167         $fWidth = 0.0002;
168         echo " <a href=\"http://localhost:8111/load_and_zoom?left=".($sLon-$fWidth)."&right=".($sLon+$fWidth)."&top=".($sLat+$fWidth)."&bottom=".($sLat-$fWidth)."\" target=\"josm\">Remote Controll (JOSM / Merkaartor)</a>";
169         echo " | <a href=\"http://www.openstreetmap.org/edit?editor=potlatch2&bbox=".($sLon-$fWidth).",".($sLat-$fWidth).",".($sLon+$fWidth).",".($sLat+$fWidth)."\" target=\"potlatch2\">Potlatch 2</a>";
170 }
171 else
172 {
173         echo " <a href=\"http://localhost:8111/import?url=http://www.openstreetmap.org/api/0.6/".$sOSMType.'/'.$sOSMID."/full\" target=\"josm\">Remote Controll (JOSM / Merkaartor)</a>";
174         // Should be better to load by object id - but this doesn't seem to zoom correctly
175         //echo " <a href=\"http://localhost:8111/load_object?new_layer=true&objects=".strtolower($aPointDetails['osm_type']).$sOSMID."\" target=\"josm\">Remote Controll (JOSM / Merkaartor)</a>";
176 }
177
178 ?></p>
179
180   </body>
181 </html>
182