Snippets Collections
<!doctype html>
<html lang="en">
    <title>Using the scripts in web pages</title>
    <meta charset="utf-8">
    <script type="module">
        import LatLon from '';
        document.addEventListener('DOMContentLoaded', function() {
            document.querySelector('#calc-dist').onclick = function() {
        function calculateDistance() {
            const p1 = LatLon.parse(document.querySelector('#point1').value);
            const p2 = LatLon.parse(document.querySelector('#point2').value);
            const dist = parseFloat(p1.distanceTo(p2).toPrecision(4));
            document.querySelector('#result-distance').textContent = dist + ' metres';
    Point 1: <input type="text" name="point1" id="point1" placeholder="lat1,lon1">
    Point 2: <input type="text" name="point2" id="point2" placeholder="lat2,lon2">
    <button type="button" id="calc-dist">Calculate distance</button>
    <output id="result-distance"></output>
 double distance = shopLocation.distanceTo(driverLocation);
double km = (distance / 1000);

Fri Mar 03 2023 08:46:46 GMT+0000 (Coordinated Universal Time)

#html #distance #nodejs

Sun Apr 17 2022 08:06:41 GMT+0000 (Coordinated Universal Time)

#xml #java #distance

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension