Skip to content

Commit

Permalink
updated yarn.lock
Browse files Browse the repository at this point in the history
  • Loading branch information
stebogit committed Jun 7, 2017
1 parent f67dbcd commit cced2cf
Show file tree
Hide file tree
Showing 16 changed files with 535 additions and 931 deletions.
27 changes: 14 additions & 13 deletions packages/turf-bbox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,25 @@ Takes a set of features, calculates the bbox of all input features, and returns

**Parameters**

- `geojson` **([FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects) \| [Feature](http://geojson.org/geojson-spec.html#feature-objects)<any>)** input features
- `geojson` **([Feature](http://geojson.org/geojson-spec.html#feature-objects) \| [FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects))** input features

**Examples**

```javascript
var line = {
"type": "Feature",
"properties": {},
"geometry": {
"type": "LineString",
"coordinates": [[-74, 40], [-78, 42], [-82, 35]]
}
}
var bbox = turf.bbox(line);

//addToMap
var pt1 = turf.point([114.175329, 22.2524])
var pt2 = turf.point([114.170007, 22.267969])
var pt3 = turf.point([114.200649, 22.274641])
var pt4 = turf.point([114.200649, 22.274641])
var pt5 = turf.point([114.186744, 22.265745])
var features = turf.featureCollection([pt1, pt2, pt3, pt4, pt5])

var bbox = turf.bbox(features);

var bboxPolygon = turf.bboxPolygon(bbox);
var addToMap = [line, bboxPolygon]

//=bbox

//=bboxPolygon
```

Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>** bbox extent in [minX, minY, maxX, maxY] order
Expand Down
30 changes: 16 additions & 14 deletions packages/turf-bbox/index.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
var coordEach = require('@turf/meta').coordEach;
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
* @param {FeatureCollection|Feature<any>} geojson input features
* @param {(Feature|FeatureCollection)} geojson input features
* @returns {Array<number>} bbox extent in [minX, minY, maxX, maxY] order
* @addToMap features, bboxPolygon
* @example
* var line = {
* "type": "Feature",
* "properties": {},
* "geometry": {
* "type": "LineString",
* "coordinates": [[-74, 40], [-78, 42], [-82, 35]]
* }
* }
* var bbox = turf.bbox(line);
* var pt1 = turf.point([114.175329, 22.2524])
* var pt2 = turf.point([114.170007, 22.267969])
* var pt3 = turf.point([114.200649, 22.274641])
* var pt4 = turf.point([114.200649, 22.274641])
* var pt5 = turf.point([114.186744, 22.265745])
* var features = turf.featureCollection([pt1, pt2, pt3, pt4, pt5])
*
* var bbox = turf.bbox(features);
*
* //addToMap
* var bboxPolygon = turf.bboxPolygon(bbox);
* var addToMap = [line, bboxPolygon]
*
* //=bbox
*
* //=bboxPolygon
*/
module.exports = function (geojson) {
var bbox = [Infinity, Infinity, -Infinity, -Infinity];
coordEach(geojson, function (coord) {
each(geojson, function (coord) {
if (bbox[0] > coord[0]) bbox[0] = coord[0];
if (bbox[1] > coord[1]) bbox[1] = coord[1];
if (bbox[2] < coord[0]) bbox[2] = coord[0];
Expand Down
8 changes: 4 additions & 4 deletions packages/turf-bbox/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@turf/bbox",
"version": "4.4.0",
"version": "3.14.0",
"description": "turf bbox module",
"main": "index.js",
"types": "index.d.ts",
Expand Down Expand Up @@ -31,10 +31,10 @@
},
"homepage": "https:/Turfjs/turf",
"devDependencies": {
"benchmark": "^2.1.4",
"tape": "^4.6.3"
"benchmark": "^1.0.0",
"tape": "^3.5.0"
},
"dependencies": {
"@turf/meta": "^4.4.0"
"@turf/meta": "^3.14.0"
}
}
133 changes: 18 additions & 115 deletions packages/turf-helpers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,19 @@ Wraps a GeoJSON [Geometry](http://geojson.org/geojson-spec.html#geometry) in a G

```javascript
var geometry = {
"type": "Point",
"coordinates": [110, 50]
};
"type": "Point",
"coordinates": [
67.5,
32.84267363195431
]
}

var feature = turf.feature(geometry);

//=feature
```

Returns **[Feature](http://geojson.org/geojson-spec.html#feature-objects)** a GeoJSON Feature
Returns **[FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects)** a FeatureCollection of input features

# point

Expand All @@ -37,9 +40,9 @@ Takes coordinates and properties (optional) and returns a new [Point](http://geo
**Examples**

```javascript
var point = turf.point([-75.343, 39.984]);
var pt1 = turf.point([-75.343, 39.984]);

//=point
//=pt1
```

Returns **[Feature](http://geojson.org/geojson-spec.html#feature-objects)&lt;[Point](http://geojson.org/geojson-spec.html#point)>** a Point feature
Expand All @@ -57,18 +60,19 @@ Takes an array of LinearRings and optionally an [Object](https://developer.mozil

```javascript
var polygon = turf.polygon([[
[-2.275543, 53.464547],
[-2.275543, 53.489271],
[-2.215118, 53.489271],
[-2.215118, 53.464547],
[-2.275543, 53.464547]
[-2.275543, 53.464547],
[-2.275543, 53.489271],
[-2.215118, 53.489271],
[-2.215118, 53.464547],
[-2.275543, 53.464547]
]], { name: 'poly1', population: 400});

//=polygon
```

- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** throw an error if a LinearRing of the polygon has too few positions
or if a LinearRing of the Polygon does not have matching Positions at the beginning & end.
or if a LinearRing of the Polygon does not have matching Positions at the
beginning & end.

Returns **[Feature](http://geojson.org/geojson-spec.html#feature-objects)&lt;[Polygon](http://geojson.org/geojson-spec.html#polygon)>** a Polygon feature

Expand Down Expand Up @@ -124,9 +128,9 @@ var features = [
turf.point([-75.534, 39.123], {name: 'Location C'})
];

var collection = turf.featureCollection(features);
var fc = turf.featureCollection(features);

//=collection
//=fc
```

Returns **[FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects)** a FeatureCollection of input features
Expand Down Expand Up @@ -225,107 +229,6 @@ var collection = turf.geometryCollection([pt, line]);

Returns **[Feature](http://geojson.org/geojson-spec.html#feature-objects)&lt;[GeometryCollection](http://geojson.org/geojson-spec.html#geometrycollection)>** a GeoJSON GeometryCollection Feature

# round

Round number to precision

**Parameters**

- `num` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Number
- `precision` **\[[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** Precision (optional, default `0`)

**Examples**

```javascript
round(120.4321)
//=120

round(120.4321, 2)
//=120.43
```

Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** rounded number

# radiansToDistance

Convert a distance measurement (assuming a spherical Earth) from radians to a more friendly unit.
Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet

**Parameters**

- `radians` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** in radians across the sphere
- `units` **\[[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** can be degrees, radians, miles, or kilometers inches, yards, metres, meters, kilometres, kilometers. (optional, default `kilometers`)

Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** distance

# distanceToRadians

Convert a distance measurement (assuming a spherical Earth) from a real-world unit into radians
Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet

**Parameters**

- `distance` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** in real units
- `units` **\[[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** can be degrees, radians, miles, or kilometers inches, yards, metres, meters, kilometres, kilometers. (optional, default `kilometers`)

Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** radians

# distanceToDegrees

Convert a distance measurement (assuming a spherical Earth) from a real-world unit into degrees
Valid units: miles, nauticalmiles, inches, yards, meters, metres, centimeters, kilometres, feet

**Parameters**

- `distance` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** in real units
- `units` **\[[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** can be degrees, radians, miles, or kilometers inches, yards, metres, meters, kilometres, kilometers. (optional, default `kilometers`)

Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** degrees

# bearingToAngle

Converts any bearing angle from the north line direction (positive clockwise)
and returns an angle between 0-360 degrees (positive clockwise), 0 being the north line

**Parameters**

- `bearing` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** angle, between -180 and +180 degrees

Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** angle between 0 and 360 degrees

# radians2degrees

Converts an angle in radians to degrees

**Parameters**

- `radians` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** angle in radians

Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** degrees between 0 and 360 degrees

# degrees2radians

Converts an angle in degrees to radians

**Parameters**

- `degrees` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** angle between 0 and 360 degrees

Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** angle in radians

# convertDistance

Converts a distance to the requested unit.
Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet

**Parameters**

- `distance` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** to be converted
- `originalUnit` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** of the distance
- `finalUnit` **\[[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** returned unit (optional, default `kilometers`)

Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** the converted distance

<!-- This file is automatically generated. Please don't edit it directly:
if you find an error, edit the source file (likely index.js), and re-run
./scripts/generate-readmes in the turf project. -->
Expand Down
60 changes: 16 additions & 44 deletions packages/turf-helpers/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,18 @@ export type Polygons = GeoJSON.FeatureCollection<GeoJSON.Polygon>;
export type Polygon = GeoJSON.Feature<GeoJSON.Polygon>;
export type MultiPolygons = GeoJSON.FeatureCollection<GeoJSON.MultiPolygon>;
export type MultiPolygon = GeoJSON.Feature<GeoJSON.MultiPolygon>;
export type Features = GeoJSON.FeatureCollection<any>;
export type Feature = GeoJSON.Feature<any>;
export type Position = GeoJSON.Position;
export type LineStringFeatures = LineString | LineStrings | MultiLineString | MultiLineStrings | GeoJSON.LineString | GeoJSON.MultiLineString
export type PolygonFeatures = Polygon | Polygons | MultiPolygon | MultiPolygons | GeoJSON.Polygon | GeoJSON.MultiPolygon
export type Features<Geom extends GeometryObject> = GeoJSON.FeatureCollection<Geom>;
export type Feature<Geom extends GeometryObject> = GeoJSON.Feature<Geom>;
export type Units = "miles" | "nauticalmiles" | "degrees" | "radians" | "inches" | "yards" | "meters" | "metres" | "kilometers" | "kilometres";
export type BBox = [number, number, number, number];
export type GeometryObject = GeoJSON.GeometryObject;
export type GeometryCollection = GeoJSON.GeometryCollection;
export type Geoms = GeoJSON.Point | GeoJSON.LineString | GeoJSON.Polygon | GeoJSON.MultiPoint | GeoJSON.MultiLineString | GeoJSON.MultiPolygon;

export interface FeatureGeometryCollection extends GeoJSON.Feature<any> {
geometry: GeometryCollection
}

/**
* http://turfjs.org/docs/#feature
*/
export function feature<Geom extends GeometryObject>(geometry: Geom, properties?: any): Feature<Geom>;
export function feature(geometry: GeoJSON.GeometryObject, properties?: any): Feature;

/**
* http://turfjs.org/docs/#point
Expand All @@ -50,11 +43,15 @@ export function lineString(coordinates: Position[], properties?: any): LineStrin
/**
* http://turfjs.org/docs/#featurecollection
*/
interface featureCollection {
<Geom extends Geoms>(features: Feature<Geom>[]): Features<Geom>;
(features: Feature<any>[]): Features<any>;
}
export const featureCollection: featureCollection;
export const featureCollection: {
(features: Array<Point>): Points;
(features: Array<LineString>): LineStrings;
(features: Array<Polygon>): Polygons;
(features: Array<MultiPoint>): MultiPoints;
(features: Array<MultiLineString>): MultiLineStrings;
(features: Array<MultiPolygon>): MultiPolygons;
(features: Array<Feature>): Features;
};

/**
* http://turfjs.org/docs/#multilinestring
Expand All @@ -74,44 +71,19 @@ export function multiPolygon(coordinates: Position[][][], properties?: any): Mul
/**
* http://turfjs.org/docs/#geometrycollection
*/
export function geometryCollection(geometries: GeometryObject[], properties?: any): FeatureGeometryCollection;
export function geometryCollection(geometries: Array<GeoJSON.GeometryObject>, properties?: any): GeoJSON.GeometryCollection;

/**
* http://turfjs.org/docs/#radianstodistance
* http://turfjs.org/docs/
*/
export function radiansToDistance(radians: number, units?: Units): number

/**
* http://turfjs.org/docs/#distancetoradians
* http://turfjs.org/docs/
*/
export function distanceToRadians(distance: number, units?: Units): number

/**
* http://turfjs.org/docs/#distancetodegrees
* http://turfjs.org/docs/
*/
export function distanceToDegrees(distance: number, units?: Units): number

/**
* http://turfjs.org/docs/#bearingtoangle
*/
export function bearingToAngle(bearing: number): number

/**
* http://turfjs.org/docs/#radians2degrees
*/
export function radians2degrees(radians: number): number

/**
* http://turfjs.org/docs/#degrees2radians
*/
export function degrees2radians(degrees: number): number

/**
* http://turfjs.org/docs/#round
*/
export function round(num: number, precision?: number): number

/**
* http://turfjs.org/docs/#convertdistance
*/
export function convertDistance(distance: number, originalUnit: Units, finalUnit?: Units): number
Loading

0 comments on commit cced2cf

Please sign in to comment.