1
<!DOCTYPE html>
2
<html>
3
<head>
4
    <meta charset="utf-8" />
5
    <title>Wialon Playground - Show nearby units</title>
6
    <script type="text/javascript" src="//code.jquery.com/jquery-latest.min.js"></script>
7
    <script type="text/javascript" src="//hst-api.wialon.com/wsdk/script/wialon.js"></script>
8
</head>
9
<body>
10
11
<!-- load map -->
12
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.2/leaflet.css" />
13
<script src="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.2/leaflet.js"></script>
HTML
17
 
1
#map { width:480px; height:400px; }
2
#log { border: 1px solid #c6c6c6; }
3
4
#usage-hint { color: gray; }
5
6
#latlng.invalid { border-color: red; }
7
8
table .unit-name span {
9
  border-bottom: 1px dashed;
10
}
11
table .unit-name:hover {
12
  cursor: pointer;
13
  background: #eee;
14
}
15
16
#results-table { display: none; }
17
#no-results { display: none; }
CSS
500
 
1
/*
2
 * Showing nearby units
3
 *
4
 * Usage:
5
 *   set position in format "latitude, longitude" and press `Find nearest to the position` button
6
 *   doubleclick on the map to set position of click
7
 *   choose unit from the list to set position of selected unit
8
 *   (click `Find nearest to the unit` button to update matching position by current unit position)
9
 *
10
 *   You can setup maximum results count/filter by time of last message
11
 *
12
 *   If you have checked `Use routing`, then it will calculate distance not geometrically,
13
 *   but by actual routes via roads, if possible.
14
 *
15
 * Implementation:
16
 *
17
 *   1. Request data and subscribe for new unit positions:
JS
Result
Source code of example Close ✕
1
 
1
/*source*/