Skip to content

Commit

Permalink
Make turf-kinks deliver on its promises
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcw committed Jun 1, 2016
2 parents f472d6e + 2a91e14 commit e445f03
Show file tree
Hide file tree
Showing 50 changed files with 184 additions and 172 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ pids
logs
results

npm-debug.log
npm-debug.log*

node_modules
3 changes: 1 addition & 2 deletions packages/turf-along/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ var destination = require('turf-destination');
* Takes a {@link LineString|line} and returns a {@link Point|point} at a specified distance along the line.
*
* @name along
* @category measurement
* @param {Feature<LineString>} line input line
* @param {Number} distance distance along the line
* @param {number} distance distance along the line
* @param {String} [units=miles] can be degrees, radians, miles, or kilometers
* @return {Feature<Point>} Point `distance` `units` along the line
* @example
Expand Down
1 change: 0 additions & 1 deletion packages/turf-area/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ var geometryArea = require('geojson-area').geometry;
* Takes a one or more features and returns their area
* in square meters.
*
* @category measurement
* @param {(Feature|FeatureCollection)} input input features
* @return {Number} area in square meters
* @example
Expand Down
1 change: 0 additions & 1 deletion packages/turf-bbox-polygon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ var polygon = require('turf-helpers').polygon;
* Takes a bbox and returns an equivalent {@link Polygon|polygon}.
*
* @name bboxPolygon
* @category measurement
* @param {Array<number>} bbox an Array of bounding box coordinates in the form: ```[xLow, yLow, xHigh, yHigh]```
* @return {Feature<Polygon>} a Polygon representation of the bounding box
* @example
Expand Down
1 change: 0 additions & 1 deletion packages/turf-bbox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ var each = require('turf-meta').coordEach;
* Takes a set of features, calculates the bbox of all input features, and returns a bounding box.
*
* @name bbox
* @category measurement
* @param {(Feature|FeatureCollection)} input input features
* @return {Array<number>} the bounding box of `input` given
* as an array in WSEN order (west, south, east, north)
Expand Down
2 changes: 0 additions & 2 deletions packages/turf-bearing/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ var getCoord = require('turf-invariant').getCoord;
* Takes two {@link Point|points} and finds the geographic bearing between them.
*
* @name bearing
* @category measurement
* @param {Feature<Point>} start starting Point
* @param {Feature<Point>} end ending Point
* @category measurement
* @returns {Number} bearing in decimal degrees
* @example
* var point1 = {
Expand Down
1 change: 0 additions & 1 deletion packages/turf-bezier/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ var Spline = require('./spline.js');
* The bezier spline implementation is by [Leszek Rybicki](http://leszek.rybicki.cc/).
*
* @name bezier
* @category transformation
* @param {Feature<LineString>} line input LineString
* @param {Number} [resolution=10000] time in milliseconds between points
* @param {Number} [sharpness=0.85] a measure of how curvy the path should be between splines
Expand Down
5 changes: 2 additions & 3 deletions packages/turf-buffer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ var normalize = require('geojson-normalize');
* Calculates a buffer for input features for a given radius. Units supported are miles, kilometers, and degrees.
*
* @name buffer
* @category transformation
* @param {(Feature|FeatureCollection)} feature input to be buffered
* @param {Number} distance distance to draw the buffer
* @param {String} unit any of the options supported by turf units
* @param {number} distance distance to draw the buffer
* @param {string} unit any of the options supported by turf units
* @return {FeatureCollection<Polygon>|FeatureCollection<MultiPolygon>|Polygon|MultiPolygon} buffered features
*
* @example
Expand Down
1 change: 0 additions & 1 deletion packages/turf-center/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ var bbox = require('turf-bbox'),
* Takes a {@link FeatureCollection} and returns the absolute center point of all features.
*
* @name center
* @category measurement
* @param {FeatureCollection} features input features
* @return {Feature<Point>} a Point feature at the
* absolute center point of all input features
Expand Down
1 change: 0 additions & 1 deletion packages/turf-centroid/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ var point = require('turf-helpers').point;
* the centroid of a set of polygons.
*
* @name centroid
* @category measurement
* @param {(Feature|FeatureCollection)} features input features
* @return {Feature<Point>} the centroid of the input features
* @example
Expand Down
1 change: 0 additions & 1 deletion packages/turf-collect/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ var inside = require('turf-inside');
* polygon.
*
* @name collect
* @category aggregation
* @param {FeatureCollection<Polygon>} polygons polygons with values on which to aggregate
* @param {FeatureCollection<Point>} points points to be aggregated
* @param {Array} aggregations an array of aggregation objects
Expand Down
1 change: 0 additions & 1 deletion packages/turf-combine/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ var meta = require('turf-meta');
* {@link MultiPolygon} features.
*
* @name combine
* @category misc
* @param {FeatureCollection<(Point|LineString|Polygon)>} fc a FeatureCollection of any type
* @return {FeatureCollection<(MultiPoint|MultiLineString|MultiPolygon)>} a FeatureCollection of corresponding type to input
* @example
Expand Down
6 changes: 2 additions & 4 deletions packages/turf-concave/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ var distance = require('turf-distance');
*
* Internally, this uses [turf-tin](https://github.com/Turfjs/turf-tin) to generate geometries.
*
* @module concave
* @category transformation
* @param {FeatureCollection<Point>} points input points
* @param {Number} maxEdge the size of an edge necessary for part of the
* @param {number} maxEdge the size of an edge necessary for part of the
* hull to become concave (in miles)
* @param {String} units used for maxEdge distance (miles or kilometers)
* @param {string} units used for maxEdge distance (miles or kilometers)
* @returns {Feature<Polygon>} a concave hull
* @throws {Error} if maxEdge parameter is missing
* @throws {Error} if units parameter is missing
Expand Down
1 change: 0 additions & 1 deletion packages/turf-convex/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ var each = require('turf-meta').coordEach,
* implements a [monotone chain hull](http://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain).
*
* @name convex
* @category transformation
* @param {FeatureCollection<Point>} input input points
* @returns {Feature<Polygon>} a convex hull
* @example
Expand Down
7 changes: 3 additions & 4 deletions packages/turf-destination/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ var distanceToRadians = helpers.distanceToRadians;
* Takes a {@link Point} and calculates the location of a destination point given a distance in degrees, radians, miles, or kilometers; and bearing in degrees. This uses the [Haversine formula](http://en.wikipedia.org/wiki/Haversine_formula) to account for global curvature.
*
* @name destination
* @category measurement
* @param {Feature<Point>} start starting point
* @param {Number} distance distance from the starting point
* @param {Number} bearing ranging from -180 to 180
* @param {String=kilometers} units miles, kilometers, degrees, or radians
* @param {number} distance distance from the starting point
* @param {number} bearing ranging from -180 to 180
* @param {String} [units=kilometers] miles, kilometers, degrees, or radians
* @returns {Feature<Point>} destination point
* @example
* var point = {
Expand Down
1 change: 0 additions & 1 deletion packages/turf-difference/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ var jsts = require('jsts');
* polygon from the first.
*
* @name difference
* @category transformation
* @param {Feature<Polygon>} poly1 input Polygon feaure
* @param {Feature<Polygon>} poly2 Polygon feature to difference from `poly1`
* @return {Feature<Polygon>} a Polygon feature showing the area of `poly1` excluding the area of `poly2`
Expand Down
1 change: 0 additions & 1 deletion packages/turf-distance/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ var radiansToDistance = require('turf-helpers').radiansToDistance;
* to account for global curvature.
*
* @name distance
* @category measurement
* @param {Feature<Point>} from origin point
* @param {Feature<Point>} to destination point
* @param {String} [units=kilometers] can be degrees, radians, miles, or kilometers
Expand Down
1 change: 0 additions & 1 deletion packages/turf-envelope/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ var bboxPolygon = require('turf-bbox-polygon');
* Takes any number of features and returns a rectangular {@link Polygon} that encompasses all vertices.
*
* @name envelope
* @category measurement
* @param {FeatureCollection} fc input features
* @return {Feature<Polygon>} a rectangular Polygon feature that encompasses all vertices
* @example
Expand Down
1 change: 0 additions & 1 deletion packages/turf-explode/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ var point = require('turf-helpers').point;
* {@link Point|points}.
*
* @name explode
* @category misc
* @param {(Feature|FeatureCollection)} input input features
* @return {FeatureCollection<point>} points representing the exploded input features
* @throws {Error} if it encounters an unknown geometry type
Expand Down
1 change: 0 additions & 1 deletion packages/turf-flip/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ var coordEach = require('turf-meta').coordEach;
* from `[x, y]` to `[y, x]`.
*
* @name flip
* @category misc
* @param {(Feature|FeatureCollection)} input input features
* @returns {(Feature|FeatureCollection)} a feature or set of features of the same type as `input` with flipped coordinates
* @example
Expand Down
21 changes: 6 additions & 15 deletions packages/turf-helpers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* Wraps a GeoJSON {@link Geometry} in a GeoJSON {@link Feature}.
*
* @name feature
* @category helper
* @param {Geometry} geometry input geometry
* @returns {FeatureCollection} a FeatureCollection of input features
* @example
Expand Down Expand Up @@ -32,8 +31,7 @@ module.exports.feature = feature;
* Takes coordinates and properties (optional) and returns a new {@link Point} feature.
*
* @name point
* @category helper
* @param {Number[]} coordinates longitude, latitude position (each in decimal degrees)
* @param {number[]} coordinates longitude, latitude position (each in decimal degrees)
* @param {Object=} properties an Object that is used as the {@link Feature}'s
* properties
* @returns {Feature<Point>} a Point feature
Expand All @@ -55,8 +53,7 @@ module.exports.point = function (coordinates, properties) {
* Takes an array of LinearRings and optionally an {@link Object} with properties and returns a {@link Polygon} feature.
*
* @name polygon
* @category helper
* @param {Array<Array<Number>>} rings an array of LinearRings
* @param {Array<Array<number>>} rings an array of LinearRings
* @param {Object=} properties a properties object
* @returns {Feature<Polygon>} a Polygon feature
* @throws {Error} throw an error if a LinearRing of the polygon has too few positions
Expand Down Expand Up @@ -100,8 +97,7 @@ module.exports.polygon = function (coordinates, properties) {
* coordinate array. Properties can be added optionally.
*
* @name lineString
* @category helper
* @param {Array<Array<Number>>} coordinates an array of Positions
* @param {Array<Array<number>>} coordinates an array of Positions
* @param {Object=} properties an Object of key-value pairs to add as properties
* @returns {Feature<LineString>} a LineString feature
* @throws {Error} if no coordinates are passed
Expand Down Expand Up @@ -137,7 +133,6 @@ module.exports.lineString = function (coordinates, properties) {
* Takes one or more {@link Feature|Features} and creates a {@link FeatureCollection}.
*
* @name featureCollection
* @category helper
* @param {Feature[]} features input features
* @returns {FeatureCollection} a FeatureCollection of input features
* @example
Expand All @@ -163,8 +158,7 @@ module.exports.featureCollection = function (features) {
* coordinate array. Properties can be added optionally.
*
* @name multiLineString
* @category helper
* @param {Array<Array<Number>>} coordinates an array of Positions
* @param {Array<Array<number>>} coordinates an array of Positions
* @param {Object=} properties an Object of key-value pairs to add as properties
* @returns {Feature<MultiLineString>} a MultiLineString feature
* @throws {Error} if no coordinates are passed
Expand All @@ -189,8 +183,7 @@ module.exports.multiLineString = function (coordinates, properties) {
* coordinate array. Properties can be added optionally.
*
* @name multiPoint
* @category helper
* @param {Array<Array<Number>>} coordinates an array of Positions
* @param {Array<Array<number>>} coordinates an array of Positions
* @param {Object=} properties an Object of key-value pairs to add as properties
* @returns {Feature<MultiPoint>} a MultiPoint feature
* @throws {Error} if no coordinates are passed
Expand All @@ -216,8 +209,7 @@ module.exports.multiPoint = function (coordinates, properties) {
* coordinate array. Properties can be added optionally.
*
* @name multiPolygon
* @category helper
* @param {Array<Array<Number>>} coordinates an array of Positions
* @param {Array<Array<number>>} coordinates an array of Positions
* @param {Object=} properties an Object of key-value pairs to add as properties
* @returns {Feature<MultiPolygon>} a multipolygon feature
* @throws {Error} if no coordinates are passed
Expand All @@ -242,7 +234,6 @@ module.exports.multiPolygon = function (coordinates, properties) {
* coordinate array. Properties can be added optionally.
*
* @name geometryCollection
* @category helper
* @param {Array<{Geometry}>} geometries an array of GeoJSON Geometries
* @param {Object=} properties an Object of key-value pairs to add as properties
* @returns {Feature<GeometryCollection>} a geometrycollection feature
Expand Down
5 changes: 2 additions & 3 deletions packages/turf-hex-grid/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ for (var i = 0; i < 6; i++) {
* described in [Hexagonal Grids](http://www.redblobgames.com/grids/hexagons/).
*
* @name hexGrid
* @category interpolation
* @param {Array<number>} bbox bounding box in [minX, minY, maxX, maxY] order
* @param {Number} cellWidth width of cell in specified units
* @param {String} units used in calculating cellWidth ('miles' or 'kilometers')
* @param {number} cellWidth width of cell in specified units
* @param {string} units used in calculating cellWidth ('miles' or 'kilometers')
* @return {FeatureCollection<Polygon>} a hexagonal grid
* @example
* var bbox = [-96,31,-84,40];
Expand Down
1 change: 0 additions & 1 deletion packages/turf-inside/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ var invariant = require('turf-invariant');
* be convex or concave. The function accounts for holes.
*
* @name inside
* @category joins
* @param {Feature<Point>} point input point
* @param {Feature<(Polygon|MultiPolygon)>} polygon input polygon or multipolygon
* @return {Boolean} `true` if the Point is inside the Polygon; `false` if the Point is not inside the Polygon
Expand Down
1 change: 0 additions & 1 deletion packages/turf-intersect/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ var jsts = require('jsts');
* Takes two {@link Polygon|polygons} and finds their intersection. If they share a border, returns the border; if they don't intersect, returns undefined.
*
* @name intersect
* @category transformation
* @param {Feature<Polygon>} poly1 the first polygon
* @param {Feature<Polygon>} poly2 the second polygon
* @return {(Feature<Polygon>|undefined|Feature<MultiLineString>)} if `poly1` and `poly2` overlap, returns a Polygon feature representing the area they overlap; if `poly1` and `poly2` do not overlap, returns `undefined`; if `poly1` and `poly2` share a border, a MultiLineString of the locations where their borders are shared
Expand Down
6 changes: 3 additions & 3 deletions packages/turf-invariant/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function getCoord(obj) {
* @alias geojsonType
* @param {GeoJSON} value any GeoJSON object
* @param {string} type expected GeoJSON type
* @param {String} name name of calling function
* @param {string} name name of calling function
* @throws {Error} if value is not the expected type.
*/
function geojsonType(value, type, name) {
Expand All @@ -48,7 +48,7 @@ function geojsonType(value, type, name) {
* @alias featureOf
* @param {Feature} feature a feature with an expected geometry type
* @param {string} type expected GeoJSON type
* @param {String} name name of calling function
* @param {string} name name of calling function
* @throws {Error} error if value is not the expected type.
*/
function featureOf(value, type, name) {
Expand All @@ -68,7 +68,7 @@ function featureOf(value, type, name) {
* @alias collectionOf
* @param {FeatureCollection} featurecollection a featurecollection for which features will be judged
* @param {string} type expected GeoJSON type
* @param {String} name name of calling function
* @param {string} name name of calling function
* @throws {Error} if value is not the expected type.
*/
function collectionOf(value, type, name) {
Expand Down
7 changes: 3 additions & 4 deletions packages/turf-isolines/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ var Conrec = require('./conrec');
* value breaks and generates [isolines](http://en.wikipedia.org/wiki/Isoline).
*
* @name isolines
* @category interpolation
* @param {FeatureCollection<Point>} points input points
* @param {String} z the property name in `points` from which z-values will be pulled
* @param {Number} resolution resolution of the underlying grid
* @param {Array<Number>} breaks where to draw contours
* @param {string} z the property name in `points` from which z-values will be pulled
* @param {number} resolution resolution of the underlying grid
* @param {Array<number>} breaks where to draw contours
* @returns {FeatureCollection<LineString>} isolines
* @example
* // create random points with random
Expand Down
1 change: 0 additions & 1 deletion packages/turf-kinks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* Takes a {@link Polygon|polygon} and returns {@link Point|points} at all self-intersections.
*
* @name kinks
* @category misc
* @param {Feature<Polygon>|Polygon} polygon input polygon
* @returns {FeatureCollection<Point>} self-intersections
* @example
Expand Down
Loading

0 comments on commit e445f03

Please sign in to comment.