{"_id":"@arunawalpola/leaflet.polylinemeasure","_rev":"5-d012ce6955e409c23fc0dd8035e48364","name":"@arunawalpola/leaflet.polylinemeasure","dist-tags":{"latest":"1.0.4"},"versions":{"1.0.0":{"name":"@arunawalpola/leaflet.polylinemeasure","version":"1.0.0","author":"","license":"BSD-2-Clause","_id":"@arunawalpola/leaflet.polylinemeasure@1.0.0","maintainers":[{"name":"arunawalpola","email":"arunawalpola@gmail.com"}],"homepage":"https://github.com/ArunaWalpola/netromax.leaflet.polylinemeasure#readme","bugs":{"url":"https://github.com/ArunaWalpola/netromax.leaflet.polylinemeasure/issues"},"dist":{"shasum":"68c557a8769c7c15e6277c0f162905b6ec34056f","tarball":"https://registry.npmjs.org/@arunawalpola/leaflet.polylinemeasure/-/leaflet.polylinemeasure-1.0.0.tgz","fileCount":12,"integrity":"sha512-hINwMdUHywAtAr9ZzGM+Q64O0d+j8sOUCHpjpKRDXLU2uiffQlp39ZxyJdOi19SC7YdN0gpvOxK4Bh/tuqtCXA==","signatures":[{"sig":"MEYCIQDGfY5wbsPsaHQQEiilt/YCcIDYoO2MOfmKsOMovZyZWQIhAJ4G+lAWQybLxnmpQGI6Cct8dm3Zw1HTsoh8t8+8bmIV","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":214615},"main":"Leaflet.PolylineMeasure.js","gitHead":"9908e5a2cbd2753c335ac758f3559ba9da6f99e9","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"arunawalpola","email":"arunawalpola@gmail.com"},"repository":{"url":"git+https://github.com/ArunaWalpola/netromax.leaflet.polylinemeasure.git","type":"git"},"_npmVersion":"10.9.2","description":"Leaflet Plugin to measure distances of simple lines as well as of complex polylines","directories":{},"_nodeVersion":"22.14.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/leaflet.polylinemeasure_1.0.0_1766775072663_0.6718043078366327","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@arunawalpola/leaflet.polylinemeasure","version":"1.0.1","author":"","license":"BSD-2-Clause","_id":"@arunawalpola/leaflet.polylinemeasure@1.0.1","maintainers":[{"name":"arunawalpola","email":"arunawalpola@gmail.com"}],"homepage":"https://github.com/ArunaWalpola/netromax.leaflet.polylinemeasure#readme","bugs":{"url":"https://github.com/ArunaWalpola/netromax.leaflet.polylinemeasure/issues"},"dist":{"shasum":"15d7da08b552a94090a39c4890d7b0f1f947b984","tarball":"https://registry.npmjs.org/@arunawalpola/leaflet.polylinemeasure/-/leaflet.polylinemeasure-1.0.1.tgz","fileCount":12,"integrity":"sha512-VW6db/OfIt4nMCKeigYL3NSV+SfjOEz9glvD6GwOzc1ifh/ZUY9BazFgZrGQV66M9LkrNLPZ75BWEm1EAbxcwg==","signatures":[{"sig":"MEUCIDYF8coNNYdVYgiHMBWAXw572WN/Htcv5FDE+keQDeYQAiEA4FIxc4v7v9awmgvSSUMKWSYmhzJSy/shrNTu/77k6V0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":214778},"main":"Leaflet.PolylineMeasure.js","gitHead":"84e86435e36d1d7d01632e0a5358a9fea3d74f89","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"arunawalpola","email":"arunawalpola@gmail.com"},"repository":{"url":"git+https://github.com/ArunaWalpola/netromax.leaflet.polylinemeasure.git","type":"git"},"_npmVersion":"10.9.2","description":"Leaflet Plugin to measure distances of simple lines as well as of complex polylines","directories":{},"_nodeVersion":"22.14.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/leaflet.polylinemeasure_1.0.1_1766775489399_0.6227205446887782","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@arunawalpola/leaflet.polylinemeasure","version":"1.0.2","author":"","license":"BSD-2-Clause","_id":"@arunawalpola/leaflet.polylinemeasure@1.0.2","maintainers":[{"name":"arunawalpola","email":"arunawalpola@gmail.com"}],"homepage":"https://github.com/ArunaWalpola/netromax.leaflet.polylinemeasure#readme","bugs":{"url":"https://github.com/ArunaWalpola/netromax.leaflet.polylinemeasure/issues"},"dist":{"shasum":"1119d7bdd3b155795afd4a982bea64490d316f99","tarball":"https://registry.npmjs.org/@arunawalpola/leaflet.polylinemeasure/-/leaflet.polylinemeasure-1.0.2.tgz","fileCount":12,"integrity":"sha512-UWHEB9a8p1FZJ8XqSH1mqrz2bQz4SUttk9OEepnuPDZn6JYOFYInmTQKCtXV/V/KtQJUnSPgikYMjBiCu8WzHA==","signatures":[{"sig":"MEQCIBJN2u/VbQU/tLK0B2+RXjDHpVrYv6duC0DosN5GmnuiAiAqSWYzVrdAgpq3jQkOVILHKjrPepuwcTYe3n4eEJR5mA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":214915},"main":"Leaflet.PolylineMeasure.js","gitHead":"7a3a0a7efeabed150e2f1e2a9fd22885d151bec6","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"arunawalpola","email":"arunawalpola@gmail.com"},"repository":{"url":"git+https://github.com/ArunaWalpola/netromax.leaflet.polylinemeasure.git","type":"git"},"_npmVersion":"10.9.2","description":"Leaflet Plugin to measure distances of simple lines as well as of complex polylines","directories":{},"_nodeVersion":"22.14.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/leaflet.polylinemeasure_1.0.2_1766781451270_0.051979185424261054","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@arunawalpola/leaflet.polylinemeasure","version":"1.0.3","author":"","license":"BSD-2-Clause","_id":"@arunawalpola/leaflet.polylinemeasure@1.0.3","maintainers":[{"name":"arunawalpola","email":"arunawalpola@gmail.com"}],"homepage":"https://github.com/ArunaWalpola/netromax.leaflet.polylinemeasure#readme","bugs":{"url":"https://github.com/ArunaWalpola/netromax.leaflet.polylinemeasure/issues"},"dist":{"shasum":"347b1ffee4bd135bf443e60915f4481c765e9058","tarball":"https://registry.npmjs.org/@arunawalpola/leaflet.polylinemeasure/-/leaflet.polylinemeasure-1.0.3.tgz","fileCount":12,"integrity":"sha512-5cggr8JjZck8SROh/pwM6qb+Ajf4D7laOS+413RVnP6tccpYqejLq3bYs5B24TjP0yuAw4IV7YqL7MSXWgT3xg==","signatures":[{"sig":"MEUCICVT6g1Rq5xaDPxD8P79Ucs2xz8aQpaSS1w3OQhOLOz5AiEAzZGz8AffNiSoNWUzdNgbAu/8YJKb5lIrmIzlffgi0uk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":214854},"main":"Leaflet.PolylineMeasure.js","gitHead":"34592adc8eb9b81eae7ccf317b81eae9d97a6d2c","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"arunawalpola","email":"arunawalpola@gmail.com"},"repository":{"url":"git+https://github.com/ArunaWalpola/netromax.leaflet.polylinemeasure.git","type":"git"},"_npmVersion":"10.9.2","description":"Leaflet Plugin to measure distances of simple lines as well as of complex polylines","directories":{},"_nodeVersion":"22.14.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/leaflet.polylinemeasure_1.0.3_1766782419127_0.8378351899134093","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@arunawalpola/leaflet.polylinemeasure","version":"1.0.4","description":"Leaflet Plugin to measure distances of simple lines as well as of complex polylines","main":"Leaflet.PolylineMeasure.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/ArunaWalpola/netromax.leaflet.polylinemeasure.git"},"author":"","license":"BSD-2-Clause","bugs":{"url":"https://github.com/ArunaWalpola/netromax.leaflet.polylinemeasure/issues"},"homepage":"https://github.com/ArunaWalpola/netromax.leaflet.polylinemeasure#readme","_id":"@arunawalpola/leaflet.polylinemeasure@1.0.4","gitHead":"4ceef3c0dca7ed9ad6d9c7ff6df9722eca1685eb","_nodeVersion":"22.14.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-DNtLlzq9MYNOOdPjGXaj6YSBr/cO1f7vDAUmBQ8RdUgQdrlFBmM98NZrYHnZTRYwWOxFEAIuuDQuLcTgeLTIWg==","shasum":"a28442831e771dc13591ddba30ca96468584ea6a","tarball":"https://registry.npmjs.org/@arunawalpola/leaflet.polylinemeasure/-/leaflet.polylinemeasure-1.0.4.tgz","fileCount":12,"unpackedSize":214141,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCgc3iyErMEyQdzsGNnJQeEqSienFlxyeYJDJbv/+KERwIgcEmk0U8DeCPcWa2RKdAVKGnHCCc4hkneoWaUcTHBKcY="}]},"_npmUser":{"name":"arunawalpola","email":"arunawalpola@gmail.com"},"directories":{},"maintainers":[{"name":"arunawalpola","email":"arunawalpola@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/leaflet.polylinemeasure_1.0.4_1766786711048_0.7205153353667608"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-26T18:51:12.531Z","modified":"2025-12-26T22:05:11.429Z","1.0.0":"2025-12-26T18:51:12.841Z","1.0.1":"2025-12-26T18:58:09.571Z","1.0.2":"2025-12-26T20:37:31.447Z","1.0.3":"2025-12-26T20:53:39.313Z","1.0.4":"2025-12-26T22:05:11.206Z"},"bugs":{"url":"https://github.com/ArunaWalpola/netromax.leaflet.polylinemeasure/issues"},"license":"BSD-2-Clause","homepage":"https://github.com/ArunaWalpola/netromax.leaflet.polylinemeasure#readme","repository":{"type":"git","url":"git+https://github.com/ArunaWalpola/netromax.leaflet.polylinemeasure.git"},"description":"Leaflet Plugin to measure distances of simple lines as well as of complex polylines","maintainers":[{"name":"arunawalpola","email":"arunawalpola@gmail.com"}],"readme":"\r\n\r\n# Leaflet.PolylineMeasure\r\n* Leaflet Plugin to **measure distances** of simple lines as well as of complex polylines.\r\n* Measuring in **metric system** (metres, kilometres), in **imperial system** (feet, landmiles), or in **nautical miles**.\r\n* Lines are drawn as realistic arcs. **Bearings** and **distances** are calculated considering [**Great-circle distance**](https://en.wikipedia.org/wiki/Great-circle_distance) which is the shortest path between 2 points on Earth.\r\n* **Arrows** indicating the **real midways** of the line's great-circle **distances**, not their optical middle which is different due to projection, especially in high latitudes.\r\n* To **finish** drawing a line just *doubleclick*, or *singleclick* onto the last (=orange) point, or *press \"ESC\"-key*.\r\n* **Moving** of line's points afterwards is possible by clicking and draging them. *(This feature can not be guaranteed to work on every **mobile** browser using touch input, e.g. with Chrome Mobile it isn't working right now)*\r\n* To **continue** a line after it has been finished, hold the *Ctrl-Key* while clicking onto the first or last point of a line.\r\n* To **add** points, hold the *Ctrl-Key* while clicking onto an arrow.\r\n* To **delete** points, hold the *Shift-Key* while clicking onto a point.\r\n* It is an evolution of jtreml's Plugin [leaflet.measure](https://github.com/jtreml/leaflet.measure) since the original plugin hasn't been bugfixed for years. I modified it to work again with **Leaflet v1.0 and newer** (still runs with Leaflet v0.7) and added functional and optical improvements.\r\n\r\n## Demos\r\n* Please take a look at these demos:\r\n- [**Demo 1**](https://ppete2.github.io/Leaflet.PolylineMeasure/demo1.html) (kilometre units, bearings, with Clear Control and Unit Control buttons)\r\n- [**Demo 2**](https://ppete2.github.io/Leaflet.PolylineMeasure/demo2.html)  (landmile units, without bearings, without Unit Control button)\r\n- [**Demo 3**](https://ppete2.github.io/Leaflet.PolylineMeasure/demo3.html) (nautical mile units, bearings, without Unit Control and Clear Control buttons)\r\n- [**Demo 4**](https://ppete2.github.io/Leaflet.PolylineMeasure/demo4.html) (two maps)\r\n- [**Demo 5**](https://ppete2.github.io/Leaflet.PolylineMeasure/demo5.html) (programatically providing polyline points - \"Seeding Data\")\r\n\r\n![Screenshot](https://ppete2.github.io/Leaflet.PolylineMeasure/screenshot.jpg)\r\n\r\n## Usage\r\n\r\nAdd 2 code lines within your **HTML-file** to load the .css and .js files of the plugin:\r\n```html\r\n<link rel=\"stylesheet\" href=\"https://ppete2.github.io/Leaflet.PolylineMeasure/Leaflet.PolylineMeasure.css\" />\r\n<script src=\"https://ppete2.github.io/Leaflet.PolylineMeasure/Leaflet.PolylineMeasure.js\"></script>\r\n```\r\n\r\nAdd 1 code line within your **Javascript-file** to add the plugin's control into your Leaflet map.  \r\n```js\r\nL.control.polylineMeasure(options).addTo(map);\r\n```\r\n\r\n## Package manager install\r\n\r\nIt's possible to install and update the Plugin using package managers like `npm`. This feature has been added by other users. I'm not familiar nor responsible to keep these package manager installs up-to-date. If you notice such installs being outdated, feel free to provide a Pull request or contact one of the persons who introduced package manager installs, thanks.\r\n\r\n## Default options\r\n\r\n```js\r\noptions = {\r\n    position: 'topleft',            // Position to show the control. Values: 'topright', 'topleft', 'bottomright', 'bottomleft'\r\n    unit: 'kilometres',             // Default unit the distances are displayed in. Values: 'kilometres', 'landmiles', 'nauticalmiles'\r\n    useSubunits: true,              // Use subunits (metres/feet) in tooltips if distances are less than 1 kilometre/landmile\r\n    clearMeasurementsOnStop: true,  // Clear all measurements when Measure Control is switched off\r\n    showBearings: false,            // Whether bearings are displayed within the tooltips\r\n    bearingTextIn: 'In',            // language dependend label for inbound bearings\r\n    bearingTextOut: 'Out',          // language dependend label for outbound bearings\r\n    tooltipTextFinish: 'Click to <b>finish line</b><br>',\r\n    tooltipTextDelete: 'Press SHIFT-key and click to <b>delete point</b>',\r\n    tooltipTextMove: 'Click and drag to <b>move point</b><br>',\r\n    tooltipTextResume: '<br>Press CTRL-key and click to <b>resume line</b>',\r\n    tooltipTextAdd: 'Press CTRL-key and click to <b>add point</b>',\r\n                                    // language dependend labels for point's tooltips\r\n    measureControlTitleOn: 'Turn on PolylineMeasure',   // Title for the Measure Control going to be switched on\r\n    measureControlTitleOff: 'Turn off PolylineMeasure', // Title for the Measure Control going to be switched off\r\n    measureControlLabel: '&#8614;', // Label of the Measure Control (Unicode symbols are possible)\r\n    measureControlClasses: [],      // Classes to apply to the Measure Control\r\n    showClearControl: false,        // Show a control to clear all the measurements\r\n    clearControlTitle: 'Clear Measurements', // Title text to show on the Clear Control\r\n    clearControlLabel: '&times',    // Label of the Clear Control (Unicode symbols are possible)\r\n    clearControlClasses: [],        // Classes to apply to Clear Control\r\n    showUnitControl: false,         // Show a control to change the units of measurements\r\n    unitControlUnits: [\"kilometres\", \"landmiles\", \"nauticalmiles\"],\r\n                                    // measurement units being cycled through by using the Unit Control\r\n    unitControlTitle: {             // Title texts to show on the Unit Control\r\n        text: 'Change Units',\r\n        kilometres: 'kilometres',\r\n        landmiles: 'land miles',\r\n        nauticalmiles: 'nautical miles'\r\n    },\r\n    unitControlLabel: {             // Unit symbols to show in the Unit Control and measurement labels\r\n        metres: 'm',\r\n        kilometres: 'km',\r\n        feet: 'ft',\r\n        landmiles: 'mi',\r\n        nauticalmiles: 'nm'\r\n    },\r\n    unitControlClasses: [],         // Classes to apply to the Unit Control\r\n    tempLine: {                     // Styling settings for the temporary dashed line\r\n        color: '#00f',              // Dashed line color\r\n        weight: 2                   // Dashed line weight\r\n    },          \r\n    fixedLine: {                    // Styling for the solid line\r\n        color: '#006',              // Solid line color\r\n        weight: 2                   // Solid line weight\r\n    },\r\n    arrow: {                        // Styling of the midway arrow \r\n        color: '#000',              // Color of the arrow\r\n    },\r\n    startCircle: {                  // Style settings for circle marker indicating the starting point of the polyline\r\n        color: '#000',              // Color of the border of the circle\r\n        weight: 1,                  // Weight of the circle\r\n        fillColor: '#0f0',          // Fill color of the circle\r\n        fillOpacity: 1,             // Fill opacity of the circle\r\n        radius: 3                   // Radius of the circle\r\n    },\r\n    intermedCircle: {               // Style settings for all circle markers between startCircle and endCircle\r\n        color: '#000',              // Color of the border of the circle\r\n        weight: 1,                  // Weight of the circle\r\n        fillColor: '#ff0',          // Fill color of the circle\r\n        fillOpacity: 1,             // Fill opacity of the circle\r\n        radius: 3                   // Radius of the circle\r\n    },\r\n    currentCircle: {                // Style settings for circle marker indicating the latest point of the polyline during drawing a line\r\n        color: '#000',              // Color of the border of the circle\r\n        weight: 1,                  // Weight of the circle\r\n        fillColor: '#f0f',          // Fill color of the circle\r\n        fillOpacity: 1,             // Fill opacity of the circle\r\n        radius: 6                   // Radius of the circle\r\n    },\r\n    endCircle: {                    // Style settings for circle marker indicating the last point of the polyline\r\n        color: '#000',              // Color of the border of the circle\r\n        weight: 1,                  // Weight of the circle\r\n        fillColor: '#f00',          // Fill color of the circle\r\n        fillOpacity: 1,             // Fill opacity of the circle\r\n        radius: 3                   // Radius of the circle\r\n    },\r\n};\r\n```\r\n\r\n## Events\r\nSeveral Events are fired during the use of the Plugin in order to offer interactivity outside the Plugin.\r\nSubscribe to events with:\r\n\r\n```js\r\nmap.on('polylinemeasure:toogle', e => { /* e.sttus */ });\r\nmap.on('polylinemeasure:start', currentLine => {...});\r\nmap.on('polylinemeasure:resume', currentLine => {...});\r\nmap.on('polylinemeasure:finish', currentLine => {...});\r\nmap.on('polylinemeasure:change', currentLine => {...});\r\nmap.on('polylinemeasure:clear', e => {...});\r\nmap.on('polylinemeasure:add', e => { /* e.latlng */ });\r\nmap.on('polylinemeasure:insert', e => { /* e.latlng */ });\r\nmap.on('polylinemeasure:move', e => { /* e.latlng ; e.sourceTarget._latlng */ });\r\nmap.on('polylinemeasure:remove', e => { /* e.latlng ; e.sourceTarget._latlng */ });\r\n```\r\n* Please take a look at [**Demo 1**](https://ppete2.github.io/Leaflet.PolylineMeasure/demo1.html), where those events get listed in the JS console of your browser\r\n\r\n## Seeding Data\r\nYou can programatically draw measured polylines using the `.seed` method.  It takes an array of arrays of `L.LatLng`, which enables drawing multiple, discontinuous polylines:\r\n\r\n```js\r\nlet polylineMeasure = L.control.polylineMeasure(options);\r\npolylineMeasure.addTo (map);\r\n\r\nconst line1coords = [\r\n    { lat: 22.156883186860703, lng: -158.95019531250003 },\r\n    { lat: 22.01436065310322, lng: -157.33520507812503 },\r\n    { lat: 21.391704731036587, lng: -156.17065429687503 },\r\n    { lat: 20.64306554672647, lng: -155.56640625000003 }\r\n];\r\nconst line2coords = [\r\n    { lat: 19.880391767822505, lng: -159.67529296875003 },\r\n    { lat: 17.90556881196468, lng: -156.39038085937503 }\r\n];\r\n\r\npolylineMeasure.seed([line1coords, line2coords])\r\n```\r\n\r\n* Please take a look at [**Demo 5**](https://ppete2.github.io/Leaflet.PolylineMeasure/demo5.html), where multiple polylines are drawn and measured programatically.\r\n","readmeFilename":"README.md"}