# pointAlong

return type | Object ( GeoJSON Point )
syntax | $.geo.pointAlong( Object shape ( GeoJSON object ), Number percentage )

usage

    var pointAlong = $.geo.pointAlong( {
          type: "LineString",
          coordinates: [[
            [-75, 39.7],
            [-74.8, 39.3],
            [-75.2, 39.3]
          ]]
    }, .5 )

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.

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.

If the argument is not a basic GeoJSON geometry object, this function returns undefined.

This function is similar to LineSegment.pointAlong in JTS.