]> git.openstreetmap.org Git - nominatim.git/blob - lib/template/address-html.php
HTML map: new button -show map bounds- in top right corner
[nominatim.git] / lib / template / address-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/search.css" rel="stylesheet" type="text/css" />
7 </head>
8
9 <body id="reverse-page">
10
11         <?php include(CONST_BasePath.'/lib/template/includes/html-top-navigation.php'); ?>
12
13         <form class="form-inline" role="search" accept-charset="UTF-8" action="<?php echo CONST_Website_BaseURL; ?>reverse.php">
14                 <div class="form-group">
15                         <input name="format" type="hidden" value="html">
16                         <input name="lat" type="text" class="form-control input-sm" placeholder="latitude"  value="<?php echo htmlspecialchars($_GET['lat']); ?>" >
17                         <input name="lon" type="text" class="form-control input-sm" placeholder="longitude" value="<?php echo htmlspecialchars($_GET['lon']); ?>" >
18                         max zoom
19
20                         <select name="zoom" class="form-control input-sm" value="<?php echo htmlspecialchars($_GET['zoom']); ?>">
21                                 <option value="" <?php echo $_GET['zoom']==''?'selected':'' ?> >--</option>
22                                 <?php
23
24                                         $aZoomLevels = array(
25                                                  0 => "Continent / Sea",
26                                                  1 => "",
27                                                  2 => "",
28                                                  3 => "Country",
29                                                  4 => "",
30                                                  5 => "State",
31                                                  6 => "Region",
32                                                  7 => "",
33                                                  8 => "County",
34                                                  9 => "",
35                                                 10 => "City",
36                                                 11 => "",
37                                                 12 => "Town / Village",
38                                                 13 => "",
39                                                 14 => "Suburb",
40                                                 15 => "",
41                                                 16 => "Street",
42                                                 17 => "",
43                                                 18 => "Building",
44                                                 19 => "",
45                                                 20 => "",
46                                                 21 => "",
47                                         );
48
49                                         foreach($aZoomLevels as $iZoomLevel => $sLabel)
50                                         {
51                                                 $bSel = isset($_GET['zoom']) && ($_GET['zoom'] == (string)$iZoomLevel);
52                                                 echo '<option value="'.$iZoomLevel.'"'.($bSel?'selected':'').'>'.$iZoomLevel.' '.$sLabel.'</option>'."\n";
53                                         }
54                                 ?>
55                         </select>
56                 </div>
57                 <div class="form-group search-button-group">
58                         <button type="submit" class="btn btn-primary btn-sm">Search</button>
59                 </div>
60                 <div class="search-type-link">
61                         <a href="<?php echo CONST_Website_BaseURL; ?>search.php">forward search</a>
62                 </div>
63         </form>
64
65
66         <div id="content">
67
68 <?php if ($aPlace) { ?>
69
70                 <div id="searchresults" class="sidebar">
71                 <?php
72                         $aResult = $aPlace;
73
74                         echo '<div class="result" data-position="0">';
75
76                         echo (isset($aResult['icon'])?'<img alt="icon" src="'.$aResult['icon'].'"/>':'');
77                         echo ' <span class="name">'.htmlspecialchars($aResult['langaddress']).'</span>';
78                         if (isset($aResult['label']))
79                                 echo ' <span class="type">('.$aResult['label'].')</span>';
80                         else if ($aResult['type'] == 'yes')
81                                 echo ' <span class="type">('.ucwords(str_replace('_',' ',$aResult['class'])).')</span>';
82                         else
83                                 echo ' <span class="type">('.ucwords(str_replace('_',' ',$aResult['type'])).')</span>';
84                         echo '<p>'.$aResult['lat'].','.$aResult['lon'].'</p>';
85                         echo ' <a class="btn btn-default btn-xs details" href="details.php?place_id='.$aResult['place_id'].'">details</a>';
86                         echo '</div>';
87                 ?>
88                 </div>
89
90 <?php } else { ?>
91
92                 <div id="intro" class="sidebar">
93                         Search for coordinates or click anywhere on the map.
94                 </div>
95
96 <?php } ?>
97
98                 <div id="map-wrapper">
99                         <div id="map-position">
100                                 <div id="map-position-inner"></div>
101                                 <div id="map-position-close"><a href="#">hide</a></div>
102                         </div>
103                         <div id="map"></div>
104                 </div>
105
106         </div> <!-- /content -->
107
108
109
110
111
112
113
114         <script type="text/javascript">
115         <?php
116
117                 $aNominatimMapInit = array(
118                         'zoom' => isset($_GET['zoom']) ? htmlspecialchars($_GET['zoom']) : CONST_Default_Zoom,
119                         'lat'  => isset($_GET['lat']) ? htmlspecialchars($_GET['lat']) : CONST_Default_Lat,
120                         'lon'  => isset($_GET['lon']) ? htmlspecialchars($_GET['lon']) : CONST_Default_Lon,
121                         'tile_url' => $sTileURL,
122                         'tile_attribution' => $sTileAttribution
123                 );
124                 echo 'var nominatim_map_init = ' . json_encode($aNominatimMapInit, JSON_PRETTY_PRINT) . ';';
125
126                 echo 'var nominatim_results = ' . json_encode([$aPlace], JSON_PRETTY_PRINT) . ';'; 
127         ?>
128         </script>
129         <?php include(CONST_BasePath.'/lib/template/includes/html-footer.php'); ?>
130
131 </body>
132 </html>