-
Notifications
You must be signed in to change notification settings - Fork 39
/
heremaps2.html
208 lines (171 loc) · 6.13 KB
/
heremaps2.html
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<html>
<head>
<link rel="stylesheet" type="text/css" href="https://js.api.here.com/v3/3.1/mapsjs-ui.css" />
<link rel="stylesheet" type="text/css" href="demo.css" />
<link rel="stylesheet" type="text/css" href="styles.css" />
<link rel="stylesheet" type="text/css" href="../template.css" />
<script type="text/javascript" src='../test-credentials.js'></script>
<script type="text/javascript" src="https://js.api.here.com/v3/3.1/mapsjs-core.js"></script>
<script type="text/javascript" src="https://js.api.here.com/v3/3.1/mapsjs-service.js"></script>
<script type="text/javascript" src="https://js.api.here.com/v3/3.1/mapsjs-ui.js"></script>
<script type="text/javascript" src="https://js.api.here.com/v3/3.1/mapsjs-mapevents.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script type="text/javascript" src='../js-examples-rendering-helpers/iframe-height.js'></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
#main-box{
width:100%;
min-height:100vh;
background-color:#ccc;
position:absolute;
display:none;
}
</style>
</head>
<body>
<div id="main-box"></div>
<h1 align="center" style="padding:10px;font-size:40px;color:red;font-family:sans-serif;">police patrolling system</h1>
<script>
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
x.innerHTML = "Geolocation is not supported by this browser.";
}
}
function showPosition(position) {
x.innerHTML = "Latitude: " + position.coords.latitude +
"<br>Longitude: " + position.coords.longitude;
}
</script>
<hr />
<h3 align="center" style="padding:10px;font-size:30px;color:blue;font-family:sans-serif;">click on the icon below then click on inspect(ctrl+shift+I)to view the map </h3>
<i class="fa fa-map-marker" style="color:red;text-align:center;font-size:90px;margin-left:50%;margin-top:15px;cursor:pointer;z-index:50;" id="icon"></i>
<ul style="font-size:40px;color:rgb(121,24,354);padding-left:50px;">
<li>Know police vehicle current location</li>
<li>know their location from nearest police station</li>
<li>See the location by the advanced technology</li>
<li>Map that makes India next superpower</li>
</ul>
<div style="width: 80%; height: 680px;box-shadow:0px 0px 8px black;border-radius:15px;display:none;position:absolute;top:140px;left:10%;right:10%;background-color:white;z-index:100;" id="mapContainer"></div>
<script>
document.getElementById("icon").onclick=function(){
$("#mapContainer").slideDown(800);
$("#main-box").css("display","block");
$("#main-box").click(function(){
$("#mapContainer").slideUp(800,function(){
$("#main-box").css("display","none");
});
});
}
// Initialize the platform object:
var platform = new H.service.Platform({
'apikey': '6huV8EhuXvWigDtekB'
});
// Obtain the default map types from the platform object
var defaultLayers = platform.createDefaultLayers();
// Instantiate (and display) a map object:
var map = new H.Map(
document.getElementById('mapContainer'),
defaultLayers.vector.normal.map,
{
zoom: 10,
center: { lng: 75.89, lat: 27.03
}
});
window.addEventListener('resize', ()=> map.getViewPort().resize());
var behavior = new H.mapevents.Behavior(new H.mapevents.MapEvents(map));
var ui = H.ui.UI.createDefault(map, defaultLayers);
/**
* Adds markers to the map highlighting Berlin.
*
* https://developer.here.com/api-explorer/maps-js/markers/markers-on-the-map
*
* @param {H.Map} map A HERE Map instance within the application
*/
var cord = [{lat:27.03,
lng:75.77},{lat:27.0322,
lng:75.8925},{ lat:27.0224,
lng:75.8849},{
lat:26.9826,
lng:75.7809
},{
lat:26.9795,
lng:75.9262
},{
lat:26.9428,
lng:75.9331
},{
lat:26.9621,
lng:75.8013
},{
lat:26.9853,
lng:75.7721
},{
lat:26.9685,
lng:75.7754
},{
lat:26.9495,
lng:75.754
},{
lat:26.9495,
lng:75.754
}]
for (var i = 0; i < 11; i++) {
var Marker = new H.map.Marker({
lat:cord[i].lat,
lng:cord[i].lng,
});
map.addObject(Marker);
map.addObject(new H.map.Circle(
// The central point of the circle
{lat:cord[i].lat, lng:cord[i].lng},
// The radius of the circle in meters
1000,
{
style: {
strokeColor: 'rgba(0, 204, 204, 0.2)', // Color of the perimeter
lineWidth: 2,
fillColor: 'rgba(0, 204, 204, 0.2)' // Color of the circle
}
}
));
}
</script>
<p>Click the button to get your coordinates.</p>
<button onclick="getLocation()">Try It</button>
<p id="demo"></p>
<script>
var x = document.getElementById("demo");
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
x.innerHTML = "Geolocation is not supported by this browser.";
}
}
function showPosition(position) {
x.innerHTML = "Latitude: " + position.coords.latitude +
"<br>Longitude: " + position.coords.longitude;
}
/**
* Adds a circle over New Delhi with a radius of 1000 metres onto the map
*
* @param {H.Map} map A HERE Map instance within the application
*/
map.addObject(new H.map.Circle(
// The central point of the circle
{lat:27.03, lng:75.77},
// The radius of the circle in meters
1000,
{
style: {
strokeColor: 'rgba(0, 204, 204, 0.2)', // Color of the perimeter
lineWidth: 2,
fillColor: 'rgba(0, 204, 204, 0.2)' // Color of the circle
}
}
));
</script>
</body>
</html>