Update Intersect for GeoJSON.Feature<any> inputs#479
Closed
DenisCarriere wants to merge 1 commit intoTurfjs:masterfrom
DenisCarriere:patch-11
Closed
Update Intersect for GeoJSON.Feature<any> inputs#479DenisCarriere wants to merge 1 commit intoTurfjs:masterfrom DenisCarriere:patch-11
DenisCarriere wants to merge 1 commit intoTurfjs:masterfrom
DenisCarriere:patch-11
Conversation
Using `intersection` in `jsts` can be applied to any type of GeoJSON in any combinations.
Things can get pretty confusing depending in the parameters.
Example: **intersect(poly, poly)** returns `Point` | `Line` | `Polygon`
Here's a TypeScript definition that would best describe the functionality with overloaded methods.
```javascript
intersect(
feature1: GeoJSON.Feature<GeoJSON.Point>,
feature2: GeoJSON.Feature<GeoJSON.Point>
): GeoJSON.Feature<GeoJSON.Point>;
intersect(
feature1: GeoJSON.Feature<GeoJSON.LineString>,
feature2: GeoJSON.Feature<GeoJSON.LineString>
): GeoJSON.Feature<GeoJSON.Point | GeoJSON.LineString>;
intersect(
feature1: GeoJSON.Feature<GeoJSON.Polygon>,
feature2: GeoJSON.Feature<GeoJSON.Polygon>
): GeoJSON.Feature<GeoJSON.Point | GeoJSON.LineString | GeoJSON.Polygon>;
intersect(
feature1: GeoJSON.Feature<GeoJSON.MultiPoint>,
feature2: GeoJSON.Feature<GeoJSON.MultiPoint>
): GeoJSON.Feature<GeoJSON.Point | GeoJSON.MultiPoint>;
intersect(
feature1: GeoJSON.Feature<GeoJSON.MultiLineString>,
feature2: GeoJSON.Feature<GeoJSON.MultiLineString>
): GeoJSON.Feature<GeoJSON.Point | GeoJSON.LineString | GeoJSON.MultiLineString>;
intersect(
feature1: GeoJSON.Feature<GeoJSON.MultiPolygon>,
feature2: GeoJSON.Feature<GeoJSON.MultiPolygon>
): GeoJSON.Feature<GeoJSON.Point | GeoJSON.LineString | GeoJSON.Polygon | GeoJSON.MultiPolygon>;
intersect(
feature1: GeoJSON.Feature<GeoJSON.Polygon | GeoJSON.Point>,
feature2: GeoJSON.Feature<GeoJSON.Polygon | GeoJSON.Point>
): GeoJSON.Feature<GeoJSON.Point>;
intersect(
feature1: GeoJSON.Feature<GeoJSON.Polygon | GeoJSON.LineString>,
feature2: GeoJSON.Feature<GeoJSON.Polygon | GeoJSON.LineString>
): GeoJSON.Feature<GeoJSON.Point | GeoJSON.LineString>;
intersect(
feature1: GeoJSON.Feature<GeoJSON.Polygon | GeoJSON.MultiLineString>,
feature2: GeoJSON.Feature<GeoJSON.Polygon | GeoJSON.MultiLineString>
): GeoJSON.Feature<GeoJSON.Point | GeoJSON.LineString | GeoJSON.MultiLineString>;
intersect(
feature1: GeoJSON.Feature<GeoJSON.Polygon | GeoJSON.MultiPolygon>,
feature2: GeoJSON.Feature<GeoJSON.Polygon | GeoJSON.MultiPolygon>
): GeoJSON.Feature<GeoJSON.Point | GeoJSON.LineString | GeoJSON.Polygon | GeoJSON.MultiLineString | GeoJSON.MultiPolygon>;
intersect(
feature1: GeoJSON.Feature<any>,
feature2: GeoJSON.Feature<any>
): GeoJSON.Feature<any>;
```
Member
|
So far, I've restricted turf-intersect to only officially support |
Contributor
Author
|
@morganherlocker I totally agree, this would be a total nightmare to explain. You did the right move to restrict the support for only |
vvakame
pushed a commit
to DefinitelyTyped/DefinitelyTyped
that referenced
this pull request
Sep 19, 2016
* Define Turf 3.5.2 definition Update all methods with newest JSDocs & tests based on the latest TurfJS library. AGGREGATION - [x] collect MEASUREMENT - [ ] along - [ ] area - [ ] bboxPolygon - [ ] bearing - [ ] center - [ ] centroid - [ ] destination - [ ] distance - [ ] envelope - [ ] lineDistance - [ ] midpoint - [ ] pointOnSurface - [ ] square TRANSFORMATION - [ ] bezier - [ ] buffer - [ ] concave - [ ] convex - [ ] difference - [ ] intersect - [ ] simplify - [ ] union MISC - [ ] combine - [ ] explode - [ ] flip - [ ] kinks - [ ] lineSlice - [ ] pointOnLine HELPER - [x] featureCollection - [x] feature - [x] lineString - [x] multiLineString - [x] point - [x] multiPoint - [x] polygon - [x] multiPolygon - [x] geometryCollection DATA - [x] random - [x] sample INTERPOLATION - [ ] isolines - [ ] planepoint - [ ] tin JOINS - [ ] inside - [ ] tag GRIDS - [ ] hexGrid - [ ] pointGrid - [ ] squareGrid - [ ] triangleGrid - [ ] within CLASSIFICATION - [ ] nearest META - [ ] propEach - [ ] coordEach - [ ] coordReduce - [ ] featureEach - [ ] getCoord ASSERTIONS - [ ] featureOf - [ ] collectionOf - [ ] bbox - [ ] circle - [ ] geojsonType - [ ] propReduce - [ ] coordAll - [ ] tesselate * Added Turf Grids functions - Added more variables to data initialisation. - Remove excess feature points. - Add URL in `@name` in function JSDocs GRIDS - [x] hexGrid - [x] pointGrid - [x] squareGrid - [x] triangleGrid * Use the latest Turf import - Added in test case how to import individal functions npm install in Node.js ``` npm install @turf/turf ``` https://github.com/Turfjs/turf * Change Turf functions into interfaces * Added Turf typeof units `units` is an optional parameter for all Turf functions with the following options `'miles' | 'nauticalmiles' | 'degrees' | 'radians' | 'inches' | 'yards' | 'meters' | 'metres' | 'kilometers' | 'kilometres'` * Update Turf `inside` & `tag` Add JSDocs & validate both methods * Add imports to Turf submodules * Add Author to Turf @vvakame followed the same syntax as Lodash * Simplify Turf `intersect` interface Turf only officially supports `poly,poly`, all other geometry input/outputs are valid, however can't control the outputs. Turfjs/turf#479 * Comment Turf export default module Next release of Turf will have this implemented * Remove default export turf Was meant to be a comment instead, removed it for now to be safe, it will become available next release * Added Turf.bbox function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Using
intersectioninjstscan be applied to any type of GeoJSON in any combinations.Things can get pretty confusing depending in the parameters.
Example: intersect(poly, poly) returns
Point|Line|PolygonHere's a TypeScript definition that would best describe the functionality with overloaded methods.