@konfirm/geojson 1.0.0 → 1.0.1-beta.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 +7 -7
- package/dist/{geojson.d.ts → main.d.mts} +18 -79
- package/dist/main.d.ts +137 -15
- package/dist/main.global.js +853 -0
- package/dist/main.global.js.map +1 -0
- package/dist/main.js +824 -0
- package/dist/main.js.map +1 -0
- package/dist/main.mjs +772 -0
- package/dist/main.mjs.map +1 -0
- package/package.json +101 -63
- package/.editorconfig +0 -16
- package/.github/workflows/release.yml +0 -21
- package/.github/workflows/tests.yml +0 -56
- package/CHANGELOG.md +0 -21
- package/dist/Domain/Constants.d.ts +0 -5
- package/dist/Domain/GeoJSON/Concept/Altitude.d.ts +0 -3
- package/dist/Domain/GeoJSON/Concept/BoundingBox.d.ts +0 -6
- package/dist/Domain/GeoJSON/Concept/ExteriorRing.d.ts +0 -4
- package/dist/Domain/GeoJSON/Concept/GeoJSONObject.d.ts +0 -11
- package/dist/Domain/GeoJSON/Concept/InteriorRing.d.ts +0 -4
- package/dist/Domain/GeoJSON/Concept/Latitude.d.ts +0 -3
- package/dist/Domain/GeoJSON/Concept/LinearRing.d.ts +0 -4
- package/dist/Domain/GeoJSON/Concept/Longitude.d.ts +0 -3
- package/dist/Domain/GeoJSON/Concept/Position.d.ts +0 -7
- package/dist/Domain/GeoJSON/Feature.d.ts +0 -12
- package/dist/Domain/GeoJSON/FeatureCollection.d.ts +0 -8
- package/dist/Domain/GeoJSON/GeoJSON.d.ts +0 -7
- package/dist/Domain/GeoJSON/Geometry/LineString.d.ts +0 -11
- package/dist/Domain/GeoJSON/Geometry/MultiLineString.d.ts +0 -7
- package/dist/Domain/GeoJSON/Geometry/MultiPoint.d.ts +0 -8
- package/dist/Domain/GeoJSON/Geometry/MultiPolygon.d.ts +0 -7
- package/dist/Domain/GeoJSON/Geometry/Point.d.ts +0 -11
- package/dist/Domain/GeoJSON/Geometry/Polygon.d.ts +0 -11
- package/dist/Domain/GeoJSON/Geometry.d.ts +0 -9
- package/dist/Domain/GeoJSON/GeometryCollection.d.ts +0 -8
- package/dist/Domain/GeoJSON/GeometryObject.d.ts +0 -12
- package/dist/Domain/Guards/Number.d.ts +0 -3
- package/dist/Domain/Guards/Tuple.d.ts +0 -3
- package/dist/Domain/Iterator/IterablePair.d.ts +0 -32
- package/dist/Domain/Iterator/SimpleGeometry.d.ts +0 -90
- package/dist/Domain/Utility/Calculate.d.ts +0 -9
- package/dist/Domain/Utility/Distance.d.ts +0 -3
- package/dist/Domain/Utility/Intersect.d.ts +0 -2
- package/dist/Domain/Utility/Segments.d.ts +0 -2
- package/dist/Domain/Utility/Winding.d.ts +0 -3
- package/dist/geojson.cjs.js +0 -655
- package/dist/geojson.cjs.min.js +0 -1
- package/dist/geojson.es.js +0 -627
- package/dist/geojson.es.min.js +0 -1
- package/dist/geojson.js +0 -660
- package/dist/geojson.min.js +0 -1
- package/rollup.config.mjs +0 -43
- package/source/Domain/Constants.ts +0 -5
- package/source/Domain/GeoJSON/Concept/Altitude.ts +0 -9
- package/source/Domain/GeoJSON/Concept/BoundingBox.ts +0 -31
- package/source/Domain/GeoJSON/Concept/ExteriorRing.ts +0 -12
- package/source/Domain/GeoJSON/Concept/GeoJSONObject.ts +0 -23
- package/source/Domain/GeoJSON/Concept/InteriorRing.ts +0 -12
- package/source/Domain/GeoJSON/Concept/Latitude.ts +0 -7
- package/source/Domain/GeoJSON/Concept/LinearRing.ts +0 -14
- package/source/Domain/GeoJSON/Concept/Longitude.ts +0 -7
- package/source/Domain/GeoJSON/Concept/Position.ts +0 -18
- package/source/Domain/GeoJSON/Feature.ts +0 -24
- package/source/Domain/GeoJSON/FeatureCollection.ts +0 -16
- package/source/Domain/GeoJSON/GeoJSON.ts +0 -9
- package/source/Domain/GeoJSON/Geometry/LineString.ts +0 -12
- package/source/Domain/GeoJSON/Geometry/MultiLineString.ts +0 -9
- package/source/Domain/GeoJSON/Geometry/MultiPoint.ts +0 -10
- package/source/Domain/GeoJSON/Geometry/MultiPolygon.ts +0 -9
- package/source/Domain/GeoJSON/Geometry/Point.ts +0 -12
- package/source/Domain/GeoJSON/Geometry/Polygon.ts +0 -20
- package/source/Domain/GeoJSON/Geometry.ts +0 -11
- package/source/Domain/GeoJSON/GeometryCollection.ts +0 -23
- package/source/Domain/GeoJSON/GeometryObject.ts +0 -20
- package/source/Domain/Guards/Number.ts +0 -13
- package/source/Domain/Guards/Tuple.ts +0 -6
- package/source/Domain/Guards/Utility.ts +0 -1
- package/source/Domain/Iterator/IterablePair.ts +0 -47
- package/source/Domain/Iterator/SimpleGeometry.ts +0 -137
- package/source/Domain/Utility/Calculate.ts +0 -143
- package/source/Domain/Utility/Distance.ts +0 -56
- package/source/Domain/Utility/Intersect.ts +0 -42
- package/source/Domain/Utility/Numeric.ts +0 -8
- package/source/Domain/Utility/Segments.ts +0 -5
- package/source/Domain/Utility/Winding.ts +0 -19
- package/source/main.ts +0 -20
- package/test/Domain/GeoJSON/Concept/Altitude.ts +0 -58
- package/test/Domain/GeoJSON/Concept/BoundingBox.ts +0 -77
- package/test/Domain/GeoJSON/Concept/ExteriorRing.ts +0 -65
- package/test/Domain/GeoJSON/Concept/GeoJSONObject.ts +0 -56
- package/test/Domain/GeoJSON/Concept/InteriorRing.ts +0 -65
- package/test/Domain/GeoJSON/Concept/Latitude.ts +0 -56
- package/test/Domain/GeoJSON/Concept/LinearRing.ts +0 -63
- package/test/Domain/GeoJSON/Concept/Longitude.ts +0 -56
- package/test/Domain/GeoJSON/Concept/Position.ts +0 -56
- package/test/Domain/GeoJSON/Feature.ts +0 -9
- package/test/Domain/GeoJSON/FeatureCollection.ts +0 -9
- package/test/Domain/GeoJSON/GeoJSON.ts +0 -21
- package/test/Domain/GeoJSON/Geometry/LineString.ts +0 -11
- package/test/Domain/GeoJSON/Geometry/MultiLineString.ts +0 -11
- package/test/Domain/GeoJSON/Geometry/MultiPoint.ts +0 -11
- package/test/Domain/GeoJSON/Geometry/MultiPolygon.ts +0 -11
- package/test/Domain/GeoJSON/Geometry/Point.ts +0 -11
- package/test/Domain/GeoJSON/Geometry/Polygon.ts +0 -11
- package/test/Domain/GeoJSON/Geometry.ts +0 -9
- package/test/Domain/GeoJSON/GeometryCollection.ts +0 -9
- package/test/Domain/GeoJSON/GeometryObject.ts +0 -4
- package/test/Domain/Guards/Number.ts +0 -49
- package/test/Domain/Guards/Tuple.ts +0 -27
- package/test/Domain/Iterator/IterablePair.ts +0 -203
- package/test/Domain/Iterator/SimpleGeometry.ts +0 -195
- package/test/Domain/Utility/Calculate.ts +0 -178
- package/test/Domain/Utility/Distance.ts +0 -19
- package/test/Domain/Utility/Intersect.ts +0 -54
- package/test/Domain/Utility/Numeric.ts +0 -30
- package/test/Domain/Utility/Winding.ts +0 -52
- package/test/README.ts +0 -123
- package/test/data/Distance.ts +0 -51
- package/test/data/HolySee.ts +0 -74
- package/test/data/Intersect.ts +0 -300
- package/test/data/Italy.ts +0 -2883
- package/test/data/SanMarino.ts +0 -83
- package/test/data/Shapes.ts +0 -107
- package/test/helper/geometry.ts +0 -76
- package/test/helper/malform.ts +0 -82
- package/test/main.ts +0 -4
- package/tsconfig.json +0 -12
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Guard, Validator } from "@konfirm/guard";
|
|
2
|
-
import { GeoJSONObject } from "./Concept/GeoJSONObject";
|
|
3
|
-
type GeometryBase = GeoJSONObject & {
|
|
4
|
-
coordinates: Array<unknown>;
|
|
5
|
-
};
|
|
6
|
-
export type GeometryObject<T extends GeometryBase> = Omit<GeometryBase, 'coordinates'> & T;
|
|
7
|
-
export type MultiGeometryObject<T extends GeometryBase> = GeometryObject<{
|
|
8
|
-
type: `Multi${T['type']}`;
|
|
9
|
-
coordinates: Array<T['coordinates']>;
|
|
10
|
-
}>;
|
|
11
|
-
export declare function isGeometryObject<T extends GeometryBase>(type: string, isCoordinates: Validator): Guard<T>;
|
|
12
|
-
export {};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Iterator class which traverses all value pairs of two or more Iterable instances
|
|
3
|
-
*
|
|
4
|
-
* @export
|
|
5
|
-
* @class IterablePairIterator
|
|
6
|
-
* @template T
|
|
7
|
-
*/
|
|
8
|
-
export declare class IterablePairIterator<T = unknown> {
|
|
9
|
-
private readonly iterators;
|
|
10
|
-
/**
|
|
11
|
-
* Constructs a new instance of IterablePairIterator
|
|
12
|
-
*
|
|
13
|
-
* @param iterators
|
|
14
|
-
*/
|
|
15
|
-
constructor(...iterators: [Iterable<T>, Iterable<T>, ...Array<Iterable<T>>]);
|
|
16
|
-
/**
|
|
17
|
-
* Generator yielding all value pairs from the provided iterators
|
|
18
|
-
*
|
|
19
|
-
* @return {*} {Iterator<[T, T]>}
|
|
20
|
-
* @memberof IterablePairIterator
|
|
21
|
-
*/
|
|
22
|
-
[Symbol.iterator](): Iterator<[T, T]>;
|
|
23
|
-
/**
|
|
24
|
-
* Create unique Iterator<T> combinations to traverse over
|
|
25
|
-
*
|
|
26
|
-
* @private
|
|
27
|
-
* @param {Array<Iterable<T>>} source
|
|
28
|
-
* @return {*} {Array<[Iterable<T>, Iterable<T>]>}
|
|
29
|
-
* @memberof IterablePairIterator
|
|
30
|
-
*/
|
|
31
|
-
private pairs;
|
|
32
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { LineString, Point, Polygon } from "../../main";
|
|
2
|
-
import { GeoJSON } from "../GeoJSON/GeoJSON";
|
|
3
|
-
type SimpleGeometry = Point | LineString | Polygon;
|
|
4
|
-
/**
|
|
5
|
-
* Iterator class to turn any GeoJSON structure into one or more SimpleGeometry (Point | LineString | Polygon) objects
|
|
6
|
-
*
|
|
7
|
-
* @export
|
|
8
|
-
* @class SimpleGeometryIterator
|
|
9
|
-
*/
|
|
10
|
-
export declare class SimpleGeometryIterator {
|
|
11
|
-
private readonly inputs;
|
|
12
|
-
/**
|
|
13
|
-
* Creates an instance of SimpleGeometryIterator
|
|
14
|
-
*
|
|
15
|
-
* @param {...[GeoJSON, ...Array<GeoJSON>]} inputs
|
|
16
|
-
* @memberof SimpleGeometryIterator
|
|
17
|
-
*/
|
|
18
|
-
constructor(...inputs: [GeoJSON, ...Array<GeoJSON>]);
|
|
19
|
-
/**
|
|
20
|
-
* Generator yielding all SimpleGeometry objects from the provided GeoJSON structure(s)
|
|
21
|
-
*
|
|
22
|
-
* @return {*} {Iterator<SimpleGeometry>}
|
|
23
|
-
* @memberof SimpleGeometryIterator
|
|
24
|
-
*/
|
|
25
|
-
[Symbol.iterator](): Iterator<SimpleGeometry>;
|
|
26
|
-
/**
|
|
27
|
-
* unwrap any GeoJSON object into one or more SimpleGeometry object
|
|
28
|
-
*
|
|
29
|
-
* @private
|
|
30
|
-
* @param {GeoJSON} geo
|
|
31
|
-
* @return {*} {Iterable<SimpleGeometry>}
|
|
32
|
-
* @memberof SimpleGeometryIterator
|
|
33
|
-
*/
|
|
34
|
-
private unwrap;
|
|
35
|
-
/**
|
|
36
|
-
* Generate the geometries in a GeometryCollection
|
|
37
|
-
*
|
|
38
|
-
* @private
|
|
39
|
-
* @param {GeometryCollection} { geometries }
|
|
40
|
-
* @return {*} {Iterable<SimpleGeometry>}
|
|
41
|
-
* @memberof SimpleGeometryIterator
|
|
42
|
-
*/
|
|
43
|
-
private GeometryCollection;
|
|
44
|
-
/**
|
|
45
|
-
* Generate the geometries of the Feature object(s) in a FeatureCollection
|
|
46
|
-
*
|
|
47
|
-
* @private
|
|
48
|
-
* @param {FeatureCollection} { features }
|
|
49
|
-
* @return {*} {Iterable<SimpleGeometry>}
|
|
50
|
-
* @memberof SimpleGeometryIterator
|
|
51
|
-
*/
|
|
52
|
-
private FeatureCollection;
|
|
53
|
-
/**
|
|
54
|
-
* Generate the geometry of a Feature object
|
|
55
|
-
*
|
|
56
|
-
* @private
|
|
57
|
-
* @param {Feature} { geometry }
|
|
58
|
-
* @return {*} {Iterable<SimpleGeometry>}
|
|
59
|
-
* @memberof SimpleGeometryIterator
|
|
60
|
-
*/
|
|
61
|
-
private Feature;
|
|
62
|
-
/**
|
|
63
|
-
* Generate Point objects from a MultiPoint object
|
|
64
|
-
*
|
|
65
|
-
* @private
|
|
66
|
-
* @param {MultiPoint} multi
|
|
67
|
-
* @return {*} {Iterable<Point>}
|
|
68
|
-
* @memberof SimpleGeometryIterator
|
|
69
|
-
*/
|
|
70
|
-
private MultiPoint;
|
|
71
|
-
/**
|
|
72
|
-
* Generate LineString objects from a MultiLineString object
|
|
73
|
-
*
|
|
74
|
-
* @private
|
|
75
|
-
* @param {MultiLineString} multi
|
|
76
|
-
* @return {*} {Iterable<LineString>}
|
|
77
|
-
* @memberof SimpleGeometryIterator
|
|
78
|
-
*/
|
|
79
|
-
private MultiLineString;
|
|
80
|
-
/**
|
|
81
|
-
* Generate Polygon objects from a MultiPolygon object
|
|
82
|
-
*
|
|
83
|
-
* @private
|
|
84
|
-
* @param {MultiPolygon} multi
|
|
85
|
-
* @return {*} {Iterable<Polygon>}
|
|
86
|
-
* @memberof SimpleGeometryIterator
|
|
87
|
-
*/
|
|
88
|
-
private MultiPolygon;
|
|
89
|
-
}
|
|
90
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Point } from "../GeoJSON/Geometry/Point";
|
|
2
|
-
export type PointToPointCalculation = 'cartesian' | 'haversine' | 'vincenty' | ((a: Point['coordinates'], b: Point['coordinates']) => number);
|
|
3
|
-
export declare function getClosestPointOnLineByPoint(point: Point['coordinates'], line: [Point['coordinates'], Point['coordinates']]): Point['coordinates'];
|
|
4
|
-
export declare function getDistanceOfPointToPoint(a: Point['coordinates'], b: Point['coordinates'], calculation: PointToPointCalculation): number;
|
|
5
|
-
export declare function getDistanceOfPointToLine(point: Point['coordinates'], line: [Point['coordinates'], Point['coordinates']], calculation: PointToPointCalculation): number;
|
|
6
|
-
export declare function getDistanceOfLineToLine(a: [Point['coordinates'], Point['coordinates']], b: [Point['coordinates'], Point['coordinates']], calculation: PointToPointCalculation): number;
|
|
7
|
-
export declare function isLinesCrossing(a: [Point['coordinates'], Point['coordinates']], b: [Point['coordinates'], Point['coordinates']]): boolean;
|
|
8
|
-
export declare function isPointOnLine(point: Point['coordinates'], line: [Point['coordinates'], Point['coordinates']], threshold?: number): boolean;
|
|
9
|
-
export declare function isPointInRing(p: Point['coordinates'], ring: Array<Point['coordinates']>): boolean;
|