Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First pass at adding redone maps #664

Merged
merged 2 commits into from
Apr 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/turf-along/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ var destination = require('@turf/destination');
* @param {number} distance distance along the line
* @param {string} [units=kilometers] can be degrees, radians, miles, or kilometers
* @returns {Feature<Point>} Point `distance` `units` along the line
* @addToMap along, line
* @example
* var line = {
* "type": "Feature",
Expand All @@ -30,7 +29,8 @@ var destination = require('@turf/destination');
* };
*
* var along = turf.along(line, 1, 'miles');
* //=along
* //addToMap
* var addToMap = [along, line]
*/
module.exports = function (line, distance, units) {
var coords;
Expand Down
6 changes: 3 additions & 3 deletions packages/turf-area/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ var geomReduce = require('@turf/meta').geomReduce;
* @name area
* @param {FeatureCollection|Feature<any>} geojson input GeoJSON feature(s)
* @returns {number} area in square meters
* @addToMap polygon
* @example
* var polygon = {
* "type": "Feature",
Expand All @@ -29,8 +28,9 @@ var geomReduce = require('@turf/meta').geomReduce;
* }
* }
* var area = turf.area(polygon);
* //=area => square meters
* //=polygon
* //addToMap
* polygon.properties.area = area
* var addToMap = [polygon]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🏅 Nicely done! Adding the results in the properties 👍

*/
module.exports = function (geojson) {
return geomReduce(geojson, function (value, geometry) {
Expand Down
6 changes: 3 additions & 3 deletions packages/turf-bbox-clip/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var multiPolygon = helpers.multiPolygon;
* Takes a {@link Feature} and a bbox and clips the feature to the bbox using [lineclip](https://github.com/mapbox/lineclip).
* May result in degenerate edges when clipping Polygons.
*
* @name bbox-clip
* @name bboxClip
* @param {Feature<LineString|MultiLineString|Polygon|MultiPolygon>} feature feature to clip to the bbox
* @param {Array<number>} bbox extent in [minX, minY, maxX, maxY] order
* @returns {Feature<LineString|MultiLineString|Polygon|MultiPolygon>} clipped Feature
Expand All @@ -26,8 +26,8 @@ var multiPolygon = helpers.multiPolygon;
* }
*
* var clipped = turf.bboxClip(poly, bbox);
*
* //=clipped
* //addToMap
* var addToMap = [bbox, poly, clipped]
*/
module.exports = function (feature, bbox) {
var geom = getGeom(feature);
Expand Down
4 changes: 2 additions & 2 deletions packages/turf-bbox-polygon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ var polygon = require('@turf/helpers').polygon;
* var bbox = [0, 0, 10, 10];
*
* var poly = turf.bboxPolygon(bbox);
*
* //=poly
* //addToMap
* var addToMap = [poly]
*/

module.exports = function (bbox) {
Expand Down
7 changes: 2 additions & 5 deletions packages/turf-bbox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ var each = require('@turf/meta').coordEach;
* @name bbox
* @param {(Feature|FeatureCollection)} geojson input features
* @returns {Array<number>} bbox extent in [minX, minY, maxX, maxY] order
* @addToMap features, bboxPolygon
* @example
* var pt1 = turf.point([114.175329, 22.2524])
* var pt2 = turf.point([114.170007, 22.267969])
Expand All @@ -18,10 +17,8 @@ var each = require('@turf/meta').coordEach;
* var bbox = turf.bbox(features);
*
* var bboxPolygon = turf.bboxPolygon(bbox);
*
* //=bbox
*
* //=bboxPolygon
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, we can remove these comments if //addToMap is present.

* //addToMap
* var addToMap = [features, bboxPolygon]
*/
module.exports = function (geojson) {
var bbox = [Infinity, Infinity, -Infinity, -Infinity];
Expand Down
15 changes: 7 additions & 8 deletions packages/turf-bearing/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,32 @@ var getCoord = require('@turf/invariant').getCoord;
* @param {Feature<Point>} end ending Point
* @param {boolean} [final=false] calculates the final bearing if true
* @returns {number} bearing in decimal degrees, between -180 and 180 degrees (positive clockwise)
* @addToMap point1, point2
* @example
* var point1 = {
* "type": "Feature",
* "properties": {
* "marker-color": '#f00'
* },
* "properties": {},
* "geometry": {
* "type": "Point",
* "coordinates": [-75.343, 39.984]
* }
* };
* var point2 = {
* "type": "Feature",
* "properties": {
* "marker-color": '#0f0'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Removing the any extra properties.

* },
* "properties": {},
* "geometry": {
* "type": "Point",
* "coordinates": [-75.534, 39.123]
* }
* };
*
* var bearing = turf.bearing(point1, point2);
* //addToMap
* var addToMap = [point1, point2]
* point1.properties['marker-color'] = '#f00'
* point2.properties['marker-color'] = '#0f0'
* point1.properties.bearing = bearing
* //=bearing
*/

function bearing(start, end, final) {
if (final === true) return calculateFinalBearing(start, end);

Expand Down
5 changes: 2 additions & 3 deletions packages/turf-bezier/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ var Spline = require('./spline.js');
* @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
* @returns {Feature<LineString>} curved line
* @addToMap line, curved
* @example
* var line = {
* "type": "Feature",
Expand All @@ -34,9 +33,9 @@ var Spline = require('./spline.js');
* };
*
* var curved = turf.bezier(line);
* //addToMap
* curved.properties = { stroke: '#0f0' };
*
* //=curved
* var addToMap = [line, curved]
*/
module.exports = function (line, resolution, sharpness) {
var lineOut = linestring([]);
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 @@ -15,7 +15,6 @@ var normalize = require('@mapbox/geojson-normalize');
* @param {number} radius distance to draw the buffer
* @param {string} units any of the options supported by turf units
* @return {FeatureCollection<Polygon>|FeatureCollection<MultiPolygon>|Polygon|MultiPolygon} buffered features
* @addToMap pt, buffered
* @example
* var pt = {
* "type": "Feature",
Expand All @@ -28,8 +27,8 @@ var normalize = require('@mapbox/geojson-normalize');
* var unit = 'miles';
*
* var buffered = turf.buffer(pt, 500, unit);
*
* //=buffered
* //addToMap
* var addToMap = [pt, buffered]
*/

module.exports = function (feature, radius, units) {
Expand Down