@turf/point-on-feature 6.4.0 → 7.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,15 +6,15 @@
6
6
 
7
7
  Takes a Feature or FeatureCollection and returns a [Point][1] guaranteed to be on the surface of the feature.
8
8
 
9
- - Given a [Polygon][2], the point will be in the area of the polygon
10
- - Given a [LineString][3], the point will be along the string
11
- - Given a [Point][1], the point will the same as the input
9
+ * Given a [Polygon][2], the point will be in the area of the polygon
10
+ * Given a [LineString][3], the point will be along the string
11
+ * Given a [Point][1], the point will the same as the input
12
12
 
13
- **Parameters**
13
+ ### Parameters
14
14
 
15
- - `geojson` **[GeoJSON][4]** any Feature or FeatureCollection
15
+ * `geojson` **[GeoJSON][4]** any Feature or FeatureCollection
16
16
 
17
- **Examples**
17
+ ### Examples
18
18
 
19
19
  ```javascript
20
20
  var polygon = turf.polygon([[
@@ -33,7 +33,7 @@ var pointOnPolygon = turf.pointOnFeature(polygon);
33
33
  var addToMap = [polygon, pointOnPolygon];
34
34
  ```
35
35
 
36
- Returns **[Feature][5]<[Point][6]>** a point on the surface of `input`
36
+ Returns **[Feature][5]<[Point][6]>** a point on the surface of `input`
37
37
 
38
38
  [1]: https://tools.ietf.org/html/rfc7946#section-3.1.2
39
39
 
package/dist/es/index.js CHANGED
@@ -2,7 +2,7 @@ import explode from '@turf/explode';
2
2
  import centroid from '@turf/center';
3
3
  import nearestPoint from '@turf/nearest-point';
4
4
  import booleanPointInPolygon from '@turf/boolean-point-in-polygon';
5
- import { featureCollection, feature, point } from '@turf/helpers';
5
+ import { featureCollection, point, feature } from '@turf/helpers';
6
6
 
7
7
  /**
8
8
  * Takes a Feature or FeatureCollection and returns a {@link Point} guaranteed to be on the surface of the feature.
package/dist/js/index.js CHANGED
@@ -1,13 +1,18 @@
1
1
  'use strict';
2
2
 
3
- function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
4
-
5
- var explode = _interopDefault(require('@turf/explode'));
6
- var centroid = _interopDefault(require('@turf/center'));
7
- var nearestPoint = _interopDefault(require('@turf/nearest-point'));
8
- var booleanPointInPolygon = _interopDefault(require('@turf/boolean-point-in-polygon'));
3
+ var explode = require('@turf/explode');
4
+ var centroid = require('@turf/center');
5
+ var nearestPoint = require('@turf/nearest-point');
6
+ var booleanPointInPolygon = require('@turf/boolean-point-in-polygon');
9
7
  var helpers = require('@turf/helpers');
10
8
 
9
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
+
11
+ var explode__default = /*#__PURE__*/_interopDefaultLegacy(explode);
12
+ var centroid__default = /*#__PURE__*/_interopDefaultLegacy(centroid);
13
+ var nearestPoint__default = /*#__PURE__*/_interopDefaultLegacy(nearestPoint);
14
+ var booleanPointInPolygon__default = /*#__PURE__*/_interopDefaultLegacy(booleanPointInPolygon);
15
+
11
16
  /**
12
17
  * Takes a Feature or FeatureCollection and returns a {@link Point} guaranteed to be on the surface of the feature.
13
18
  *
@@ -39,7 +44,7 @@ function pointOnFeature(geojson) {
39
44
  var fc = normalize(geojson);
40
45
 
41
46
  // get centroid
42
- var cent = centroid(fc);
47
+ var cent = centroid__default['default'](fc);
43
48
 
44
49
  // check to see if centroid is on surface
45
50
  var onSurface = false;
@@ -105,7 +110,7 @@ function pointOnFeature(geojson) {
105
110
  j++;
106
111
  }
107
112
  } else if (geom.type === "Polygon" || geom.type === "MultiPolygon") {
108
- if (booleanPointInPolygon(cent, geom)) {
113
+ if (booleanPointInPolygon__default['default'](cent, geom)) {
109
114
  onSurface = true;
110
115
  }
111
116
  }
@@ -117,11 +122,11 @@ function pointOnFeature(geojson) {
117
122
  var vertices = helpers.featureCollection([]);
118
123
  for (i = 0; i < fc.features.length; i++) {
119
124
  vertices.features = vertices.features.concat(
120
- explode(fc.features[i]).features
125
+ explode__default['default'](fc.features[i]).features
121
126
  );
122
127
  }
123
128
  // Remove distanceToPoint properties from nearestPoint()
124
- return helpers.point(nearestPoint(cent, vertices).geometry.coordinates);
129
+ return helpers.point(nearestPoint__default['default'](cent, vertices).geometry.coordinates);
125
130
  }
126
131
  }
127
132
 
@@ -151,3 +156,4 @@ function pointOnSegment(x, y, x1, y1, x2, y2) {
151
156
  }
152
157
 
153
158
  module.exports = pointOnFeature;
159
+ module.exports.default = pointOnFeature;
package/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { Feature, Point, AllGeoJSON } from "@turf/helpers";
1
+ import { Feature, Point } from "geojson";
2
+ import { AllGeoJSON } from "@turf/helpers";
2
3
 
3
4
  /**
4
5
  * http://turfjs.org/docs/#pointonfeature
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turf/point-on-feature",
3
- "version": "6.4.0",
3
+ "version": "7.0.0-alpha.0",
4
4
  "description": "turf point-on-feature module",
5
5
  "author": "Turf Authors",
6
6
  "license": "MIT",
@@ -12,6 +12,7 @@
12
12
  "type": "git",
13
13
  "url": "git://github.com/Turfjs/turf.git"
14
14
  },
15
+ "funding": "https://opencollective.com/turf",
15
16
  "publishConfig": {
16
17
  "access": "public"
17
18
  },
@@ -46,19 +47,19 @@
46
47
  "test:tape": "node -r esm test.js"
47
48
  },
48
49
  "devDependencies": {
49
- "@turf/meta": "^6.4.0",
50
- "@turf/truncate": "^6.4.0",
50
+ "@turf/meta": "^7.0.0-alpha.0",
51
+ "@turf/truncate": "^7.0.0-alpha.0",
51
52
  "benchmark": "*",
52
53
  "npm-run-all": "*",
53
54
  "rollup": "*",
54
55
  "tape": "*"
55
56
  },
56
57
  "dependencies": {
57
- "@turf/boolean-point-in-polygon": "^6.4.0",
58
- "@turf/center": "^6.4.0",
59
- "@turf/explode": "^6.4.0",
60
- "@turf/helpers": "^6.4.0",
61
- "@turf/nearest-point": "^6.4.0"
58
+ "@turf/boolean-point-in-polygon": "^7.0.0-alpha.0",
59
+ "@turf/center": "^7.0.0-alpha.0",
60
+ "@turf/explode": "^7.0.0-alpha.0",
61
+ "@turf/helpers": "^7.0.0-alpha.0",
62
+ "@turf/nearest-point": "^7.0.0-alpha.0"
62
63
  },
63
- "gitHead": "1e62773cfc88c627cca8effcb5c14cfb65a905ac"
64
+ "gitHead": "0edc4c491b999e5ace770a61e1cf549f7c004189"
64
65
  }