3 <html lang="en" class="no-js">
7 <title>pointAlong | $.geo</title>
8 <meta name="description" content="jQuery Geo pointAlong method">
9 <meta name="author" content="Ryan Westphal">
11 <meta name="viewport" content="width=device-width, initial-scale=1.0">
13 <link rel="stylesheet" href="../css/style.css?v=2">
14 <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" />
19 <div id="pointAlong" data-role="page">
20 <div data-role="header" data-theme="b">
24 <div data-role="content">
28 <td>Object ( <a href="http://geojson.org/geojson-spec.html#point" rel="external">GeoJSON Point</a> )</td>
32 <td>$.geo.pointAlong( Object shape ( <a href="http://geojson.org/geojson-spec.html" rel="external">GeoJSON object</a> ), Number percentage )</td>
36 <td><pre><code>var pointAlong = $.geo.pointAlong( {
37 type: "LineString",
43 }, .5 )</code></pre></td>
46 <p>The pointAlong method calculates a Point that lies a given fraction along the passed-in basic GeoJSON geometry object. The basic geometry types are Point, LineString and Polygon. A percentage of 0.0 returns the first Point; a percentage of 1.0 returns the last.</p>
47 <p>Technically, only LineStrings can be used properly in this calculation. However, pointAlong can be calculated for other geometry types. With Point objects, pointAlong will always return a copy of the original Point. For Polygon objects, pointAlong operates on the Polygon's perimeter (outer ring), i.e., myPolygon.coordinates[0]. For Polygons, percentage values of 0.0 and 1.0 will return the same Point.</p>
48 <p>If the argument is not a basic GeoJSON geometry object, this function returns undefined.</p>
49 <p>This function is similar to LineSegment.pointAlong in JTS.</p>
51 </div> <!-- end of #container -->
53 <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
54 <script src="http://code.jquerygeo.com/jquery.geo-1.0a4.min.js"></script>
55 <script src="../js/script.js"></script>
56 <script src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script>