UNPKG

leaflet-geometryutil

Version:
3,431 lines (1,090 loc) 84.4 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <title>Global - Documentation</title> <script src="scripts/prettify/prettify.js"></script> <script src="scripts/prettify/lang-css.js"></script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css"> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <input type="checkbox" id="nav-trigger" class="nav-trigger" /> <label for="nav-trigger" class="navicon-button x"> <div class="navicon"></div> </label> <label for="nav-trigger" class="overlay"></label> <nav> <li class="nav-link nav-home-link"><a href="index.html">Home</a></li><li class="nav-heading">Tutorials</li><li class="nav-item"><a href="tutorial-closest.html">closest</a></li><li class="nav-item"><a href="tutorial-distance-length.html">distance-length</a></li><li class="nav-heading"><a href="global.html">Globals</a></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#accumulatedLengths">accumulatedLengths</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#angle">angle</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#bearing">bearing</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#belongsSegment">belongsSegment</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#closest">closest</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#closestLayer">closestLayer</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#closestLayerSnap">closestLayerSnap</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#closestOnSegment">closestOnSegment</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#computeAngle">computeAngle</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#computeSlope">computeSlope</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#destination">destination</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#destinationOnSegment">destinationOnSegment</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#distance">distance</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#distanceSegment">distanceSegment</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#extract">extract</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#interpolateOnLine">interpolateOnLine</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#interpolateOnPointSegment">interpolateOnPointSegment</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#isAfter">isAfter</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#isBefore">isBefore</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#layersWithin">layersWithin</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#length">length</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#locateOnLine">locateOnLine</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#nClosestLayers">nClosestLayers</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#readableDistance">readableDistance</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#reverse">reverse</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#rotatePoint">rotatePoint</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#startsAtExtremity">startsAtExtremity</a></span></li> </nav> <div id="main"> <h1 class="page-title">Global</h1> <section> <header> <h2> </h2> </header> <article> <div class="container-overview"> <dl class="details"> </dl> </div> <h3 class="subsection-title">Methods</h3> <div class="section-method"> <h4 class="name" id="accumulatedLengths"><span class="type-signature"></span>accumulatedLengths<span class="signature">(coords)</span><span class="type-signature"> &rarr; {Array.&lt;Number>}</span></h4> <div class="description"> <p>Returns a list of accumulated length along a line.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line123">line 123</a> </li></ul></dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>coords</code></td> <td class="type"> <span class="param-type"><code>L.Polyline</code></span> | <span class="param-type"><code>Array.&lt;L.Point></code></span> | <span class="param-type"><code>Array.&lt;L.LatLng></code></span> </td> <td class="description last"> <p>Set of coordinates</p> </td> </tr> </tbody> </table> <div class="section-returns"> <h5>Returns:</h5> <dl class="param-type"> <dt> Type: </dt> <dd> <span class="param-type"><code>Array.&lt;Number></code></span> </dd> </dl> <div class="param-desc"> <p>Array of accumulated lengths (pixels for Point, meters for LatLng)</p> </div> </div> </div> <div class="section-method"> <h4 class="name" id="angle"><span class="type-signature"></span>angle<span class="signature">(map:, latlngA:, latlngB:)</span><span class="type-signature"> &rarr; {Float}</span></h4> <div class="description"> <p>Returns the the angle of the given segment and the Equator in degrees, clockwise from 0 degrees north.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line742">line 742</a> </li></ul></dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>map:</code></td> <td class="type"> <span class="param-type"><code>L.Map</code></span> </td> <td class="description last"> <p>Leaflet map to be used for this method</p> </td> </tr> <tr> <td class="name"><code>latlngA:</code></td> <td class="type"> <span class="param-type"><code>L.LatLng</code></span> </td> <td class="description last"> <p>geographical point A of the segment</p> </td> </tr> <tr> <td class="name"><code>latlngB:</code></td> <td class="type"> <span class="param-type"><code>L.LatLng</code></span> </td> <td class="description last"> <p>geographical point B of the segment</p> </td> </tr> </tbody> </table> <div class="section-returns"> <h5>Returns:</h5> <dl class="param-type"> <dt> Type: </dt> <dd> <span class="param-type"><code>Float</code></span> </dd> </dl> <div class="param-desc"> <p>the angle in degrees.</p> </div> </div> </div> <div class="section-method"> <h4 class="name" id="bearing"><span class="type-signature"></span>bearing<span class="signature">(latlng1:, latlng2:)</span><span class="type-signature"> &rarr; {float}</span></h4> <div class="description"> <p>Returns the bearing in degrees clockwise from north (0 degrees) from the first L.LatLng to the second, at the first LatLng</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line689">line 689</a> </li></ul></dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>latlng1:</code></td> <td class="type"> <span class="param-type"><code>L.LatLng</code></span> </td> <td class="description last"> <p>origin point of the bearing</p> </td> </tr> <tr> <td class="name"><code>latlng2:</code></td> <td class="type"> <span class="param-type"><code>L.LatLng</code></span> </td> <td class="description last"> <p>destination point of the bearing</p> </td> </tr> </tbody> </table> <div class="section-returns"> <h5>Returns:</h5> <dl class="param-type"> <dt> Type: </dt> <dd> <span class="param-type"><code>float</code></span> </dd> </dl> <div class="param-desc"> <p>degrees clockwise from north.</p> </div> </div> </div> <div class="section-method"> <h4 class="name" id="belongsSegment"><span class="type-signature"></span>belongsSegment<span class="signature">(latlng, latlngA, latlngB, tolerance<span class="signature-attributes">opt, nullable</span>)</span><span class="type-signature"> &rarr; {boolean}</span></h4> <div class="description"> <p>Returns true if the latlng belongs to segment A-B</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line99">line 99</a> </li></ul></dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>latlng</code></td> <td class="type"> <span class="param-type"><code>L.LatLng</code></span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"> <p>The position to search</p> </td> </tr> <tr> <td class="name"><code>latlngA</code></td> <td class="type"> <span class="param-type"><code>L.LatLng</code></span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"> <p>geographical point A of the segment</p> </td> </tr> <tr> <td class="name"><code>latlngB</code></td> <td class="type"> <span class="param-type"><code>L.LatLng</code></span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"> <p>geographical point B of the segment</p> </td> </tr> <tr> <td class="name"><code>tolerance</code></td> <td class="type"> <span class="param-type"><code>Number</code></span> </td> <td class="attributes"> &lt;optional><br> &lt;nullable><br> </td> <td class="default"> 0.2 </td> <td class="description last"> <p>tolerance to accept if latlng belongs really</p> </td> </tr> </tbody> </table> <div class="section-returns"> <h5>Returns:</h5> <dl class="param-type"> <dt> Type: </dt> <dd> <span class="param-type"><code>boolean</code></span> </dd> </dl> </div> </div> <div class="section-method"> <h4 class="name" id="closest"><span class="type-signature"></span>closest<span class="signature">(map, layer, latlng, vertices<span class="signature-attributes">opt, nullable</span>)</span><span class="type-signature"> &rarr; {L.LatLng}</span></h4> <div class="description"> <p>Returns the closest latlng on layer.</p> <pre><code> Accept nested arrays</code></pre> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line173">line 173</a> </li></ul></dd> <dt class="tag-tutorial">Tutorials:</dt> <dd class="tag-tutorial"> <ul> <li><a href="tutorial-closest.html">closest</a></li> </ul> </dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>map</code></td> <td class="type"> <span class="param-type"><code>L.Map</code></span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"> <p>Leaflet map to be used for this method</p> </td> </tr> <tr> <td class="name"><code>layer</code></td> <td class="type"> <span class="param-type"><code>Array.&lt;L.LatLng></code></span> | <span class="param-type"><code>Array.&lt;Array.&lt;L.LatLng>></code></span> | <span class="param-type"><code>L.PolyLine</code></span> | <span class="param-type"><code>L.Polygon</code></span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"> <p>Layer that contains the result</p> </td> </tr> <tr> <td class="name"><code>latlng</code></td> <td class="type"> <span class="param-type"><code>L.LatLng</code></span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"> <p>The position to search</p> </td> </tr> <tr> <td class="name"><code>vertices</code></td> <td class="type"> <span class="param-type"><code>boolean</code></span> </td> <td class="attributes"> &lt;optional><br> &lt;nullable><br> </td> <td class="default"> false </td> <td class="description last"> <p>Whether to restrict to path vertices.</p> </td> </tr> </tbody> </table> <div class="section-returns"> <h5>Returns:</h5> <dl class="param-type"> <dt> Type: </dt> <dd> <span class="param-type"><code>L.LatLng</code></span> </dd> </dl> <div class="param-desc"> <p>Closest geographical point or null if layer param is incorrect</p> </div> </div> </div> <div class="section-method"> <h4 class="name" id="closestLayer"><span class="type-signature"></span>closestLayer<span class="signature">(map, layers, latlng)</span><span class="type-signature"> &rarr; {object}</span></h4> <div class="description"> <p>Returns the closest layer to latlng among a list of layers.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line280">line 280</a> </li></ul></dd> <dt class="tag-tutorial">Tutorials:</dt> <dd class="tag-tutorial"> <ul> <li><a href="tutorial-closest.html">closest</a></li> </ul> </dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>map</code></td> <td class="type"> <span class="param-type"><code>L.Map</code></span> </td> <td class="description last"> <p>Leaflet map to be used for this method</p> </td> </tr> <tr> <td class="name"><code>layers</code></td> <td class="type"> <span class="param-type"><code>Array.&lt;L.ILayer></code></span> </td> <td class="description last"> <p>Set of layers</p> </td> </tr> <tr> <td class="name"><code>latlng</code></td> <td class="type"> <span class="param-type"><code>L.LatLng</code></span> </td> <td class="description last"> <p>The position to search</p> </td> </tr> </tbody> </table> <div class="section-returns"> <h5>Returns:</h5> <dl class="param-type"> <dt> Type: </dt> <dd> <span class="param-type"><code>object</code></span> </dd> </dl> <div class="param-desc"> <p><code>{layer, latlng, distance}</code> or <code>null</code> if list is empty;</p> </div> </div> </div> <div class="section-method"> <h4 class="name" id="closestLayerSnap"><span class="type-signature"></span>closestLayerSnap<span class="signature">(map, layers, latlng, tolerance<span class="signature-attributes">opt, nullable</span>, withVertices<span class="signature-attributes">opt, nullable</span>)</span><span class="type-signature"> &rarr; {object}</span></h4> <div class="description"> <p>Returns the closest position from specified {LatLng} among specified layers, with a maximum tolerance in pixels, providing snapping behaviour.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line416">line 416</a> </li></ul></dd> <dt class="tag-tutorial">Tutorials:</dt> <dd class="tag-tutorial"> <ul> <li><a href="tutorial-closest.html">closest</a></li> </ul> </dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>map</code></td> <td class="type"> <span class="param-type"><code>L.Map</code></span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"> <p>Leaflet map to be used for this method</p> </td> </tr> <tr> <td class="name"><code>layers</code></td> <td class="type"> <span class="param-type"><code>Array.&lt;ILayer></code></span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"> <p>A list of layers to snap on.</p> </td> </tr> <tr> <td class="name"><code>latlng</code></td> <td class="type"> <span class="param-type"><code>L.LatLng</code></span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"> <p>The position to snap</p> </td> </tr> <tr> <td class="name"><code>tolerance</code></td> <td class="type"> <span class="param-type"><code>Number</code></span> </td> <td class="attributes"> &lt;optional><br> &lt;nullable><br> </td> <td class="default"> Infinity </td> <td class="description last"> <p>Maximum number of pixels.</p> </td> </tr> <tr> <td class="name"><code>withVertices</code></td> <td class="type"> <span class="param-type"><code>boolean</code></span> </td> <td class="attributes"> &lt;optional><br> &lt;nullable><br> </td> <td class="default"> true </td> <td class="description last"> <p>Snap to layers vertices or segment points (not only vertex)</p> </td> </tr> </tbody> </table> <div class="section-returns"> <h5>Returns:</h5> <dl class="param-type"> <dt> Type: </dt> <dd> <span class="param-type"><code>object</code></span> </dd> </dl> <div class="param-desc"> <p>with snapped {LatLng} and snapped {Layer} or null if tolerance exceeded.</p> </div> </div> </div> <div class="section-method"> <h4 class="name" id="closestOnSegment"><span class="type-signature"></span>closestOnSegment<span class="signature">(map, latlng, latlngA, latlngB)</span><span class="type-signature"> &rarr; {L.LatLng}</span></h4> <div class="description"> <p>Returns the closest point of a {L.LatLng} on the segment (A-B)</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line149">line 149</a> </li></ul></dd> <dt class="tag-tutorial">Tutorials:</dt> <dd class="tag-tutorial"> <ul> <li><a href="tutorial-closest.html">closest</a></li> </ul> </dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>map</code></td> <td class="type"> <span class="param-type"><code>L.Map</code></span> </td> <td class="description last"> <p>Leaflet map to be used for this method</p> </td> </tr> <tr> <td class="name"><code>latlng</code></td> <td class="type"> <span class="param-type"><code>L.LatLng</code></span> </td> <td class="description last"> <p>The position to search</p> </td> </tr> <tr> <td class="name"><code>latlngA</code></td> <td class="type"> <span class="param-type"><code>L.LatLng</code></span> </td> <td class="description last"> <p>geographical point A of the segment</p> </td> </tr> <tr> <td class="name"><code>latlngB</code></td> <td class="type"> <span class="param-type"><code>L.LatLng</code></span> </td> <td class="description last"> <p>geographical point B of the segment</p> </td> </tr> </tbody> </table> <div class="section-returns"> <h5>Returns:</h5> <dl class="param-type"> <dt> Type: </dt> <dd> <span class="param-type"><code>L.LatLng</code></span> </dd> </dl> <div class="param-desc"> <p>Closest geographical point</p> </div> </div> </div> <div class="section-method"> <h4 class="name" id="computeAngle"><span class="type-signature"></span>computeAngle<span class="signature">(a, b)</span><span class="type-signature"> &rarr; {Number}</span></h4> <div class="description"> <p>Returns horizontal angle in degres between two points.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line647">line 647</a> </li></ul></dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>a</code></td> <td class="type"> <span class="param-type"><code>L.Point</code></span> </td> <td class="description last"> <p>Coordinates of point A</p> </td> </tr> <tr> <td class="name"><code>b</code></td> <td class="type"> <span class="param-type"><code>L.Point</code></span> </td> <td class="description last"> <p>Coordinates of point B</p> </td> </tr> </tbody> </table> <div class="section-returns"> <h5>Returns:</h5> <dl class="param-type"> <dt> Type: </dt> <dd> <span class="param-type"><code>Number</code></span> </dd> </dl> <div class="param-desc"> <p>horizontal angle</p> </div> </div> </div> <div class="section-method"> <h4 class="name" id="computeSlope"><span class="type-signature"></span>computeSlope<span class="signature">(a, b)</span><span class="type-signature"> &rarr; {Object}</span></h4> <div class="description"> <p>Returns slope (Ax+B) between two points.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line657">line 657</a> </li></ul></dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>a</code></td> <td class="type"> <span class="param-type"><code>L.Point</code></span> </td> <td class="description last"> <p>Coordinates of point A</p> </td> </tr> <tr> <td class="name"><code>b</code></td> <td class="type"> <span class="param-type"><code>L.Point</code></span> </td> <td class="description last"> <p>Coordinates of point B</p> </td> </tr> </tbody> </table> <div class="section-returns"> <h5>Returns:</h5> <dl class="param-type"> <dt> Type: </dt> <dd> <span class="param-type"><code>Object</code></span> </dd> </dl> <div class="param-desc"> <p>with <code>a</code> and <code>b</code> properties.</p> </div> </div> </div> <div class="section-method"> <h4 class="name" id="destination"><span class="type-signature"></span>destination<span class="signature">(latlng:, heading:, distance:)</span><span class="type-signature"> &rarr; {L.latLng}</span></h4> <div class="description"> <p>Returns the point that is a distance and heading away from the given origin point.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line713">line 713</a> </li></ul></dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>latlng:</code></td> <td class="type"> <span class="param-type"><code>L.LatLng</code></span> </td> <td class="description last"> <p>origin point</p> </td> </tr> <tr> <td class="name"><code>heading:</code></td> <td class="type"> <span class="param-type"><code>float</code></span> </td> <td class="description last"> <p>heading in degrees, clockwise from 0 degrees north.</p> </td> </tr> <tr> <td class="name"><code>distance:</code></td> <td class="type"> <span class="param-type"><code>float</code></span> </td> <td class="description last"> <p>distance in meters</p> </td> </tr> </tbody> </table> <div class="section-returns"> <h5>Returns:</h5> <dl class="param-type"> <dt> Type: </dt> <dd> <span class="param-type"><code>L.latLng</code></span> </dd> </dl> <div class="param-desc"> <p>the destination point. Many thanks to Chris Veness at http://www.movable-type.co.uk/scripts/latlong.html for a great reference and examples.</p> </div> </div> </div> <div class="section-method"> <h4 class="name" id="destinationOnSegment"><span class="type-signature"></span>destinationOnSegment<span class="signature">(map:, latlngA:, latlngB:, distance:)</span><span class="type-signature"> &rarr; {L.latLng}</span></h4> <div class="description"> <p>Returns a point snaps on the segment and heading away from the given origin point a distance.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line758">line 758</a> </li></ul></dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>map:</code></td> <td class="type"> <span class="param-type"><code>L.Map</code></span> </td> <td class="description last"> <p>Leaflet map to be used for this method</p> </td> </tr> <tr> <td class="name"><code>latlngA:</code></td> <td class="type"> <span class="param-type"><code>L.LatLng</code></span> </td> <td class="description last"> <p>geographical point A of the segment</p> </td> </tr> <tr> <td class="name"><code>latlngB:</code></td> <td class="type"> <span class="param-type"><code>L.LatLng</code></span> </td> <td class="description last"> <p>geographical point B of the segment</p> </td> </tr> <tr> <td class="name"><code>distance:</code></td> <td class="type"> <span class="param-type"><code>float</code></span> </td> <td class="description last"> <p>distance in meters</p> </td> </tr> </tbody> </table> <div class="section-returns"> <h5>Returns:</h5> <dl class="param-type"> <dt> Type: </dt> <dd> <span class="param-type"><code>L.latLng</code></span> </dd> </dl> <div class="param-desc"> <p>the destination point.</p> </div> </div> </div> <div class="section-method"> <h4 class="name" id="distance"><span class="type-signature"></span>distance<span class="signature">(map, latlngA, latlngB)</span><span class="type-signature"> &rarr; {Number}</span></h4> <div class="description"> <p>Shortcut function for planar distance between two {L.LatLng} at current zoom.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line42">line 42</a> </li></ul></dd> <dt class="tag-tutorial">Tutorials:</dt> <dd class="tag-tutorial"> <ul> <li><a href="tutorial-distance-length.html">distance-length</a></li> </ul> </dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>map</code></td> <td class="type"> <span class="param-type"><code>L.Map</code></span> </td> <td class="description last"> <p>Leaflet map to be used for this method</p> </td> </tr> <tr> <td class="name"><code>latlngA</code></td> <td class="type"> <span class="param-type"><code>L.LatLng</code></span> </td> <td class="description last"> <p>geographical point A</p> </td> </tr> <tr> <td class="name"><code>latlngB</code></td> <td class="type"> <span class="param-type"><code>L.LatLng</code></span> </td> <td class="description last"> <p>geographical point B</p> </td> </tr> </tbody> </table> <div class="section-returns"> <h5>Returns:</h5> <dl class="param-type"> <dt> Type: </dt> <dd> <span class="param-type"><code>Number</code></span> </dd> </dl> <div class="param-desc"> <p>planar distance</p> </div> </div> </div> <div class="section-method"> <h4 class="name" id="distanceSegment"><span class="type-signature"></span>distanceSegment<span class="signature">(map, latlng, latlngA, latlngB)</span><span class="type-signature"> &rarr; {Number}</span></h4> <div class="description"> <p>Shortcut function for planar distance between a {L.LatLng} and a segment (A-B).</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line54">line 54</a> </li></ul></dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>map</code></td> <td class="type"> <span class="param-type"><code>L.Map</code></span> </td> <td class="description last"> <p>Leaflet map to be used for this method</p> </td> </tr> <tr> <td class="name"><code>latlng</code></td> <td class="type"> <span class="param-type"><code>L.LatLng</code></span> </td> <td class="description last"> <p>The position to search</p> </td> </tr> <tr> <td class="name"><code>latlngA</code></td> <td class="type"> <span class="param-type"><code>L.LatLng</code></span> </td> <td class="description last"> <p>geographical point A of the segment</p> </td> </tr> <tr> <td class="name"><code>latlngB</code></td> <td class="type"> <span class="param-type"><code>L.LatLng</code></span> </td> <td class="description last"> <p>geographical point B of the segment</p> </td> </tr> </tbody> </table> <div class="section-returns"> <h5>Returns:</h5> <dl class="param-type"> <dt> Type: </dt> <dd> <span class="param-type"><code>Number</code></span> </dd> </dl> <div class="param-desc"> <p>planar distance</p> </div> </div> </div> <div class="section-method"> <h4 class="name" id="extract"><span class="type-signature"></span>extract<span class="signature">(map, polyline, start, end)</span><span class="type-signature"> &rarr; {Array.&lt;L.LatLng>}</span></h4> <div class="description"> <p>Returns a sub-part of the polyline, from start to end. If start is superior to end, returns extraction from inverted line.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line573">line 573</a> </li></ul></dd>