CINXE.COM

maps_toolkit - Dart API docs

<!DOCTYPE html> <html lang="en"><head><script type="text/javascript" src="https://www.googletagmanager.com/gtm.js?id=GTM-MX6DBN9" async="async"></script><script type="text/javascript" src="/static/hash-o6oemknr/js/gtm.js"></script><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, user-scalable=no"/><meta name="generator" content="made with love by dartdoc"/><meta name="description" content="maps_toolkit API docs, for the Dart programming language."/><title>maps_toolkit - Dart API docs</title><link rel="canonical" href="https://pub.dev/documentation/maps_toolkit/latest/"/><link rel="preconnect" href="https://fonts.gstatic.com"/><link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,300;0,400;0,500;0,700;1,400&amp;display=swap"/><link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0"/><link rel="stylesheet" href="/static/hash-o6oemknr/css/dartdoc.css"/><link rel="icon" href="/favicon.ico?hash=nk4nss8c7444fg0chird9erqef2vkhb8"/></head><body class="light-theme" data-base-href="" data-using-base-href="false"><noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MX6DBN9" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript><div id="overlay-under-drawer"></div><header id="title"><span id="sidenav-left-toggle" class="material-symbols-outlined" role="button" tabindex="0">menu</span><a class="hidden-xs" href="/"><img src="/static/hash-o6oemknr/img/dart-logo.svg" alt="" width="30" height="30" role="presentation" style="height: 30px; margin-right: 1em;"/></a><ol class="breadcrumbs gt-separated dark hidden-xs"><li><a href="/packages/maps_toolkit">maps_toolkit package</a></li><li class="self-crumb">documentation</li></ol><div class="self-name">maps_toolkit package</div><form class="search navbar-right" role="search"><input id="search-box" class="form-control typeahead" type="text" placeholder="Loading search..." autocomplete="off"/></form><div id="theme-button" class="toggle" title="Toggle brightness"><label for="theme"><input id="theme" type="checkbox" value="light-theme"/><span id="dark-theme-button" class="material-symbols-outlined">dark_mode</span><span id="light-theme-button" class="material-symbols-outlined">light_mode</span></label></div></header><main><div id="dartdoc-main-content" class="main-content"> <div class="desc markdown markdown-body"> <h1 id="maps_toolkit">maps_toolkit</h1> <p><a href="https://pub.dartlang.org/packages/maps_toolkit" rel="ugc nofollow"><img src="https://img.shields.io/pub/v/maps_toolkit.svg" alt="Pub Package"></a> <a href="https://travis-ci.org/kb0/maps_toolkit" rel="ugc nofollow"><img src="https://travis-ci.org/kb0/maps_toolkit.svg?branch=master" alt="Build Status"></a> <a href="https://coveralls.io/github/kb0/maps_toolkit?branch=master" rel="ugc nofollow"><img src="https://coveralls.io/repos/github/kb0/maps_toolkit/badge.svg?branch=master" alt="Coverage Status"></a> <a href="https://github.com/kb0/maps_toolkit/issues" rel="ugc nofollow"><img src="https://img.shields.io/github/issues/kb0/maps_toolkit.svg?branch=master" alt="GitHub Issues"></a> <a href="https://github.com/kb0/maps_toolkit/network" rel="ugc nofollow"><img src="https://img.shields.io/github/forks/kb0/maps_toolkit.svg?branch=master" alt="GitHub Forks"></a> <a href="https://github.com/kb0/maps_toolkit/stargazers" rel="ugc nofollow"><img src="https://img.shields.io/github/stars/kb0/maps_toolkit.svg?branch=master" alt="GitHub Stars"></a> <a href="https://raw.githubusercontent.com/kb0/maps_toolkit/master/LICENSE" rel="ugc nofollow"><img src="https://img.shields.io/badge/license-Apache%202-blue.svg" alt="GitHub License"></a></p> <p>A library for area, distance, heading measurements (spherical_util.dart if port from <code>android-maps-utils</code>).</p> <h2 id="getting-started">Getting Started</h2> <p>In your dart/flutter project add the dependency:</p> <pre class="language-dart"><code> dependencies: ... maps_toolkit: ^3.0.0 </code></pre> <p>A simple usage example:</p> <pre class="language-dart"><code class="language-dart">import 'package:maps_toolkit/maps_toolkit.dart'; main() { val distanceBetweenPoints = SphericalUtil.computeDistanceBetween( LatLng(51.5073509, -0.1277583), LatLng(48.856614, 2.3522219) ); final p1 = LatLng(45.153474463955796, 39.33852195739747); final p2 = LatLng(45.153474463955796, 39.33972358703614); final p3 = LatLng(45.15252112936569, 39.33972358703614); final p4 = LatLng(45.1525022138355, 39.3385460972786); val areaInSquareMeters = SphericalUtil.computeArea([p1, p2, p3, p4, p1]); } </code></pre> <p>Usage with Google Maps package (specify a prefix for an import):</p> <pre class="language-dart"><code class="language-dart">import 'package:maps_toolkit/maps_toolkit.dart' as mp; import 'package:google_maps/google_maps.dart'; import 'package:test/test.dart'; void main() { final pointFromToolkit = mp.LatLng(90, 0); final pointFromGoogleMap = LatLng(90, 0); mp.SphericalUtil.computeAngleBetween(pointFromToolkit, pointFromToolkit); } </code></pre> <h2 id="list-of-functions">List of functions</h2> <ul> <li> <p><code>SphericalUtil.computeArea</code> - calculate the area of a closed path on Earth.</p> </li> <li> <p><code>SphericalUtil.computeDistanceBetween</code> - calculate the distance between two points, in meters.</p> </li> <li> <p><code>SphericalUtil.computeHeading</code> - calculate the heading from one point to another point.</p> </li> <li> <p><code>SphericalUtil.computeLength</code> - calculate the length of the given path, in meters, on Earth.</p> </li> <li> <p><code>SphericalUtil.computeOffset</code> - calculate the point resulting from moving a distance from an origin in the specified heading (expressed in degrees clockwise from north).</p> </li> <li> <p><code>SphericalUtil.computeOffsetOrigin</code> - calculate the location of origin when provided with a point destination, meters travelled and original heading.</p> </li> <li> <p><code>SphericalUtil.computeSignedArea</code> - calculate the signed area of a closed path on Earth.</p> </li> <li> <p><code>SphericalUtil.interpolate</code> - calculate the point which lies the given fraction of the way between the origin and the destination.</p> </li> <li> <p><code>PolygonUtil.containsLocation</code> - computes whether the given point lies inside the specified polygon.</p> </li> <li> <p><code>PolygonUtil.isLocationOnEdge</code> - computes whether the given point lies on or near the edge of a polygon, within a specified tolerance in meters.</p> </li> <li> <p><code>PolygonUtil.isLocationOnPath</code> - computes whether the given point lies on or near a polyline, within a specified tolerance in meters.</p> </li> <li> <p><code>PolygonUtil.locationIndexOnPath</code> - computes whether (and where) a given point lies on or near a polyline, within a specified tolerance.</p> </li> <li> <p><code>PolygonUtil.locationIndexOnEdgeOrPath</code> - computes whether (and where) a given point lies on or near a polyline, within a specified tolerance.</p> </li> <li> <p><code>PolygonUtil.simplify</code> - simplifies the given poly (polyline or polygon) using the Douglas-Peucker decimation algorithm.</p> </li> <li> <p><code>PolygonUtil.isClosedPolygon</code> - returns true if the provided list of points is a closed polygon.</p> </li> <li> <p><code>PolygonUtil.distanceToLine</code> - computes the distance on the sphere between the point p and the line segment start to end.</p> </li> <li> <p><code>PolygonUtil.decode</code> - decodes an encoded path string into a sequence of LatLngs.</p> </li> <li> <p><code>PolygonUtil.encode</code> - encodes a sequence of LatLngs into an encoded path string.</p> </li> </ul> <h2 id="features-and-bugs">Features and bugs</h2> <p>Please file feature requests and bugs at the <a href="https://github.com/kb0/maps_toolkit/issues" rel="ugc nofollow">issue tracker</a>.</p> </div> <div class="summary"> <h2>Libraries</h2> <dl> <dt id="maps_toolkit"> <span class="name"><a href="maps_toolkit/maps_toolkit-library.html">maps_toolkit</a></span> </dt> <dd>Maps toolkit (port from android-maps-utils library) </dd> </dl> </div> </div><div id="dartdoc-sidebar-left" class="sidebar sidebar-offcanvas-left"><header id="header-search-sidebar" class="hidden-l"><form class="search-sidebar" role="search"><input id="search-sidebar" class="form-control typeahead" type="text" placeholder="Loading search..." autocomplete="off"/></form></header><ol id="sidebar-nav" class="breadcrumbs gt-separated dark hidden-l"><li><a href="/packages/maps_toolkit">maps_toolkit package</a></li><li class="self-crumb">documentation</li></ol> <!-- The search input and breadcrumbs below are only responsively visible at low resolutions. --> <h5 class="hidden-xs"><span class="package-name">maps_toolkit</span> <span class="package-kind">package</span></h5> <ol> <li class="section-title">Libraries</li> <li><a href="maps_toolkit/maps_toolkit-library.html">maps_toolkit</a></li> </ol> <div id="dartdoc-sidebar-left-content"></div></div><div id="dartdoc-sidebar-right" class="sidebar sidebar-offcanvas-right"> </div></main><footer><span class="no-break">maps_toolkit 3.0.0</span></footer><script src="/static/hash-o6oemknr/dartdoc/resources/highlight.pack.js"></script><script src="/static/hash-o6oemknr/dartdoc/resources/docs.dart.js"></script></body></html>

Pages: 1 2 3 4 5 6 7 8 9 10