-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmaplayer.php
141 lines (126 loc) · 5.59 KB
/
maplayer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<?php
/*
fietsviewer - grafische weergave van fietsdata
Copyright (C) 2018 Gemeente Den Haag, Netherlands
assetwebsite - viewer en aanvraagformulier voor verkeersmanagementassets
Copyright (C) 2020 Gemeente Den Haag, Netherlands
Developed by Jasper Vries
Modified for Verkeersbordenkaart
Copyright (C) 2020 Jasper Vries
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
session_start();
include('dbconnect.inc.php');
require('functions/bounds_to_sql.php');
//popup contents
if ($_GET['get'] == 'popup') {
$json = array('html' => '');
//query om inhoud van tabel te selecteren
$qry = "SELECT `id`, `type`, `rvv_code`, `text_signs`, `location.placement`, `location.side`, `location.road.name`, `location.road.type`, `location.road.number`, `location.county.name`, `details.first_seen`, `details.last_seen`, `details.removed`, `location.wgs84.latitude`, `location.wgs84.longitude`
FROM `verkeersborden`
WHERE `id` = '" . mysqli_real_escape_string($db['link'], $_GET['id']) . "'";
$qry .= " LIMIT 1";
//voer query uit
$res = mysqli_query($db['link'], $qry);
//als er een of meer rijen zijn
if (mysqli_num_rows($res) > 0) {
$data = mysqli_fetch_assoc($res);
$html = '<img src="image.php?i=' . $data['rvv_code'] . '" style="max-width: 64px; max-height: 64px;">';
$html .= '<table>';
foreach ($data as $k => $v) {
$html .= '<tr><th>';
$html .= htmlspecialchars($k);
$html .= '</th><td>';
$html .= htmlspecialchars($v);
$html .= '</td></tr>';
}
$html .= '</table>';
$data['heading'] = '0';
$html .= '<p><a id="popup_details">Details bekijken</a></p>';
$html .= '<p><a href="https://www.google.nl/maps/?q=' . $data['location.wgs84.latitude'] . ',' . $data['location.wgs84.longitude'] . '&layer=c&cbll=' . $data['location.wgs84.latitude'] . ',' . $data['location.wgs84.longitude'] . '&cbp=11,' . $data['heading'] . ',0,0,5" target="_blank">Open locatie in Google Street View™</a></p>';
$json['html'] = $html;
}
else {
$json['html'] = '<p class="error">Geen detailinformatie gevonden' . $qry .'</p>';
}
}
//details window
elseif ($_GET['data'] == 'details') {
$json = array('html' => '', 'title' => '');
//query om inhoud van tabel te selecteren
$qry = "SELECT *
FROM `verkeersborden`
WHERE `id` = '" . mysqli_real_escape_string($db['link'], $_GET['id']) . "'";
$qry .= " LIMIT 1";
//voer query uit
$res = mysqli_query($db['link'], $qry);
//als er een of meer rijen zijn
if (mysqli_num_rows($res) > 0) {
$html = '<div style="float:left; margin-left: 8px; max-width: calc(100% - 600px);">';
$data = mysqli_fetch_assoc($res);
$html .= '<img src="image.php?i=' . $data['rvv_code'] . '" style="max-width: 64px; max-height: 64px;">';
//tabel
$html .= '<table>';
foreach ($data as $k => $v) {
$html .= '<tr><th>';
$html .= htmlspecialchars($k);
$html .= '</th><td>';
$html .= htmlspecialchars($v);
$html .= '</td></tr>';
}
$html .= '</table>';
$html .= '<input type="hidden" id="latitude" value="' . htmlspecialchars($data['location.wgs84.latitude']) . '">';
$html .= '<input type="hidden" id="longitude" value="' . htmlspecialchars($data['location.wgs84.longitude']) . '">';
$html .= '<input type="hidden" id="heading" value="0">';
$html .= '</div>';
//minimap
$html .= '<div style="float:left; margin-left: 8px;">';
$html .= ' <div id="minimap" style="width: 400px; height: 400px;"></div>';
//streetview link
$data['heading'] = '0';
$html .= '<p><a href="https://www.google.nl/maps/?q=' . $data['location.wgs84.latitude'] . ',' . $data['location.wgs84.longitude'] . '&layer=c&cbll=' . $data['location.wgs84.latitude'] . ',' . $data['location.wgs84.longitude'] . '&cbp=11,' . $data['heading'] . ',0,0,5" target="_blank">Open locatie in Google Street View™</a></p>';
//preview image
$html .= '<p><img src="' . $data['details.image'] . '" style="max-width: 400px; max-heigth: 400px;></p>';
$html .= '</div>';
$html .= '<div style="clear:both;"></div>';
$json['html'] = $html;
$json['title'] = htmlspecialchars('Verkeersbord ' . $data['id'] . ' - ' . $data['rvv_code']);
}
else {
$json['html'] = '<p class="error">Geen detailinformatie gevonden</p>';
$json['title'] = 'Geen gegevens beschikbaar';
}
}
//marker layer
else {
$json = array();
if ($_GET['zoom'] >= 15) {
//query voor verkeersborden
$qry = "SELECT `id` AS `assetid`, `rvv_code` AS `code`, `location.wgs84.latitude` AS `latitude`, `location.wgs84.longitude` AS `longitude` FROM `verkeersborden`
WHERE " . bounds_to_sql($_GET['bounds']);
$res = mysqli_query($db['link'], $qry);
while ($data = mysqli_fetch_assoc($res)) {
$json[] = array('id' => (int) $data['assetid'],
'code' => $data['code'],
'lat' => (float) $data['latitude'],
'lon' => (float) $data['longitude'],
//'heading' => 0,
//'icon' => 1,
//'itype' => 0,
//'status' => 1
);
}
}
}
header('Content-Type: application/json');
echo json_encode($json);
?>