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