terraformer
Advanced tools
Comparing version 1.0.7 to 1.0.8
@@ -7,3 +7,7 @@ # Change Log | ||
## [1.0.8] - 2017-04-24 | ||
### Changed | ||
* removed `.sass-cache` and another local debugging file from npm package | ||
## [1.0.7] - 2016-10-17 | ||
@@ -67,3 +71,4 @@ | ||
[unreleased]: https://github.com/Esri/Terraformer/compare/v1.0.7...HEAD | ||
[unreleased]: https://github.com/Esri/Terraformer/compare/v1.0.8...HEAD | ||
[1.0.8]: https://github.com/Esri/Terraformer/compare/v1.0.7...v1.0.8 | ||
[1.0.7]: https://github.com/Esri/Terraformer/compare/v1.0.6...v1.0.7 | ||
@@ -70,0 +75,0 @@ [1.0.6]: https://github.com/Esri/Terraformer/compare/v1.0.5...v1.0.6 |
@@ -29,3 +29,3 @@ var fs = require('fs'); | ||
src: ['terraformer.js'], | ||
dest: 'versions/terraformer-<%= pkg.version %>.min.js' | ||
dest: 'terraformer-<%= pkg.version %>.min.js' | ||
} | ||
@@ -99,3 +99,3 @@ }, | ||
{ | ||
src: 'versions/terraformer-<%= pkg.version %>.min.js', | ||
src: 'terraformer-<%= pkg.version %>.min.js', | ||
dest: 'terraformer/<%= pkg.version %>/terraformer.min.js' | ||
@@ -116,3 +116,2 @@ } | ||
middleman: { | ||
@@ -131,2 +130,11 @@ server: { | ||
} | ||
}, | ||
copy: { | ||
main: { | ||
files: [ | ||
// includes files within path and its sub-directories | ||
{expand: true, src: ['examples/browser/**'], dest: 'docs-build/'} | ||
], | ||
}, | ||
} | ||
@@ -146,2 +154,3 @@ | ||
grunt.loadNpmTasks('grunt-contrib-jasmine'); | ||
grunt.loadNpmTasks('grunt-contrib-copy'); | ||
grunt.loadNpmTasks('grunt-jasmine-node'); | ||
@@ -155,3 +164,4 @@ grunt.loadNpmTasks('grunt-s3'); | ||
grunt.registerTask('default', ['test']); | ||
grunt.registerTask('deploy-docs', ['middleman:build', 'gh-pages']); | ||
grunt.registerTask('docs-build', ['middleman:build', 'copy']); | ||
grunt.registerTask('deploy-docs', ['middleman:build', 'copy', 'gh-pages']); | ||
}; |
{ | ||
"name": "terraformer", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "A Geo-toolkit built in Javascript.", | ||
"main": "terraformer.js", | ||
"typings": "terraformer.d.ts", | ||
"devDependencies": { | ||
@@ -10,5 +11,6 @@ "gh-release": "^2.1.0", | ||
"grunt-complexity": "~0.1.3", | ||
"grunt-contrib-copy": "^1.0.0", | ||
"grunt-contrib-jasmine": "~0.4.2", | ||
"grunt-contrib-jshint": "0.6.x", | ||
"grunt-contrib-uglify": "~0.2.2", | ||
"grunt-contrib-uglify": "~2.0.0", | ||
"grunt-gh-pages": "~0.8.1", | ||
@@ -20,8 +22,9 @@ "grunt-jasmine-node": "^0.3.1", | ||
"phantomjs-prebuilt": "^2.1.4", | ||
"typescript": "^1.8.10", | ||
"typings": "^1.3.2" | ||
"tslint": "^4.5.1", | ||
"typescript": "^2.2.1" | ||
}, | ||
"scripts": { | ||
"test": "grunt test", | ||
"test:ts": "typings install && tsc" | ||
"test:ts": "tslint test.ts index.d.ts && tsc -p tsconfig.json && node test.js", | ||
"release": "./release.sh" | ||
}, | ||
@@ -37,3 +40,9 @@ "repository": { | ||
], | ||
"license": "MIT" | ||
"license": "MIT", | ||
"dependencies": { | ||
"@types/geojson": "^1.0.0" | ||
}, | ||
"engines": { | ||
"node": ">=4.2.6" | ||
} | ||
} |
@@ -27,3 +27,3 @@ # Terraformer | ||
Install the core module with NPM and then require it in your Node program. | ||
Install the core module with npm and then require it in your Node program. | ||
@@ -48,6 +48,6 @@ ``` | ||
To use the Terraformer library, include a reference to it using a `<script>` tag. | ||
To see Terraformer in action in the browser, check out our [live demos](http://terraformer.io/examples/browser/index.html). To use it in the browser yourself, reference it using a `<script>` tag. | ||
```html | ||
<script src="http://cdn-geoweb.s3.amazonaws.com/terraformer/1.0.4/terraformer.min.js"></script> | ||
<script src="https://unpkg.com/terraformer@1.0.8"></script> | ||
``` | ||
@@ -58,5 +58,4 @@ | ||
```html | ||
<script src="terraformer-arcgis-parser.min.js"></script> <!-- https://github.com/Esri/terraformer-arcgis-parser --> | ||
<script src="terraformer-wkt-parser.min.js"></script> <!-- https://github.com/Esri/terraformer-wkt-parser --> | ||
<script src="terraformer-geostore.min.js"></script> <!-- https://github.com/Esri/terraformer-geostore --> | ||
<script src="https://unpkg.com/terraformer-arcgis-parser@1.0.5"></script> | ||
<script src="https://unpkg.com/terraformer-wkt-parser@1.1.2"></script> | ||
``` | ||
@@ -112,4 +111,4 @@ | ||
* [Terraformer Website](http://terraformer.io) | ||
* [twitter@EsriPDX](http://twitter.com/esripdx) | ||
* [Documentation Site](http://terraformer.io) | ||
* [@EsriPDX](http://twitter.com/esripdx) | ||
@@ -128,3 +127,4 @@ ## Building the documentation | ||
[](Esri Tags: Terraformer GeoJSON) | ||
[](Esri Language: JavaScript) | ||
## Licensing | ||
A copy of the license is available in the repository's [LICENSE](./LICENSE) file. |
@@ -0,80 +1,142 @@ | ||
/** | ||
* Terraformer module | ||
* @example | ||
* import * as Terraformer from "terraformer"; | ||
*/ | ||
// Note: Terraformer module exports namespace so it can be augmented by | ||
// terraformer-wkt-parser and potentially others | ||
export as namespace Terraformer; | ||
// Export Terraformer for AMD require | ||
export = Terraformer; | ||
declare namespace Terraformer { | ||
interface Envelope { | ||
x: number, | ||
y: number, | ||
w: number, | ||
h: number | ||
export interface Envelope { | ||
x: number; | ||
y: number; | ||
w: number; | ||
h: number; | ||
} | ||
type BBox = number[]; //[number, number, number, number] | ||
export type BBox = number[]; // [number, number, number, number] | ||
type Coordinate = GeoJSON.Position | ||
type Coordinates = GeoJSON.Position[]; | ||
export type Coordinate = GeoJSON.Position; | ||
export type Coordinates = GeoJSON.Position[]; | ||
class Primitive<T extends GeoJSON.GeoJsonObject> implements GeoJSON.GeoJsonObject { | ||
/** | ||
* Terraformer Primitives are JavaScript objects that map directly to their GeoJSON couterparts. | ||
* Converting a GeoJSON object into a Terraformer Primitive will allow you use convenience methods like | ||
* point.within(polygon). | ||
* | ||
* Every Primitive inherits from the Terraformer.Primitive base class, thus all other Primitives share the | ||
* Terraformer.Primitive methods. | ||
* | ||
* There is a Primitive for every type of GeoJSON object, plus a Circle Primitive which represents a circle as a | ||
* polygon. | ||
*/ | ||
export class Primitive<T extends GeoJSON.GeoJsonObject> implements GeoJSON.GeoJsonObject { | ||
public type: string; | ||
/** | ||
* You create a new Terraformer.Primitive object by passing it a valid GeoJSON Object. This will return a | ||
* Terraformer.Primitive with the same type as your GeoJSON object. | ||
* @param geojson GeoJSON Primitive | ||
*/ | ||
constructor(geojson: T); | ||
type: string; | ||
toMercator(): this; | ||
toGeographic(): this; | ||
envelope(): Envelope; | ||
// bbox(): number[]; // Terraformer docs have this function, but conflicts with GeoJSON typescript definitions for optional bbox property. | ||
convexHull(): GeoJSON.Polygon; | ||
contains(geometry: GeoJSON.GeometryObject): boolean; | ||
within(geometry: GeoJSON.GeometryObject): boolean; | ||
intersects(geometry: GeoJSON.GeometryObject): boolean; | ||
/** | ||
* Converts this GeoJSON object’s coordinates to the web mercator spatial reference. | ||
*/ | ||
public toMercator(): this; | ||
/** | ||
* Converts this GeoJSON object’s coordinates to geographic coordinates. | ||
*/ | ||
public toGeographic(): this; | ||
/** | ||
* Returns an object with x, y, w and h suitable for passing to most indexes. | ||
*/ | ||
public envelope(): Envelope; | ||
// /** | ||
// * Returns the GeoJSON Bounding Box for this primitive. | ||
// */ | ||
// bbox(): number[]; // Terraformer docs have this function, but conflicts with GeoJSON typescript definitions for | ||
// // optional bbox property. | ||
/** | ||
* Returns the convex hull of this primitive as a Polygon. Will return null if the convex hull cannot be calculated | ||
* or a valid Polygon cannot be created. | ||
*/ | ||
public convexHull(): GeoJSON.Polygon | null; | ||
/** | ||
* Returns true if the passed GeoJSON Geometry object is completely contained inside this primitive. | ||
* @param geometry The geometry that potentially is inside of this one. | ||
* @returns Returns true if the passed GeoJSON Geometry object is completely contained inside this primitive. | ||
*/ | ||
public contains(geometry: GeoJSON.GeometryObject): boolean; | ||
/** | ||
* Returns true if the passed GeoJSON Geometry object is completely within this primitive. | ||
* @param geometry GeoJSON geometry | ||
*/ | ||
public within(geometry: GeoJSON.GeometryObject): boolean; | ||
/** | ||
* Returns true if the passed GeoJSON Geometry intersects this primitive. | ||
* @param geometry GeoJSON geometry | ||
*/ | ||
public intersects(geometry: GeoJSON.GeometryObject): boolean; | ||
} | ||
class Point extends Primitive<GeoJSON.Point> implements GeoJSON.Point { | ||
export class Point extends Primitive<GeoJSON.Point> implements GeoJSON.Point { | ||
public type: "Point"; | ||
public coordinates: GeoJSON.Position; | ||
constructor(p: GeoJSON.Point); | ||
constructor(x: number, y: number); | ||
constructor(xy: GeoJSON.Position); | ||
type: "Point"; | ||
coordinates: GeoJSON.Position; | ||
} | ||
class MultiPoint extends Primitive<GeoJSON.MultiPoint> implements GeoJSON.MultiPoint { | ||
export class MultiPoint extends Primitive<GeoJSON.MultiPoint> implements GeoJSON.MultiPoint { | ||
public type: "MultiPoint"; | ||
public coordinates: GeoJSON.Position[]; | ||
public forEach: (point: Point, index: number, coordinates: Coordinates) => null; | ||
constructor(geojsonMP: GeoJSON.MultiPoint); | ||
constructor(coordinates: Coordinates); | ||
type: "MultiPoint"; | ||
coordinates: GeoJSON.Position[]; | ||
forEach(f: Function); | ||
get(index: number): Point; | ||
addPoint(coordinate: Coordinate): this; | ||
insertPoint(coordinate: Coordinate, index: number): this; | ||
removePoint(index: number): this; | ||
removePoint(coordinate: Coordinate): this; | ||
public get(index: number): Point; | ||
public addPoint(coordinate: Coordinate): this; | ||
public insertPoint(coordinate: Coordinate, index: number): this; | ||
public removePoint(index: number): this; | ||
public removePoint(coordinate: Coordinate): this; | ||
} | ||
class LineString extends Primitive<GeoJSON.LineString> implements GeoJSON.LineString { | ||
export class LineString extends Primitive<GeoJSON.LineString> implements GeoJSON.LineString { | ||
public type: "LineString"; | ||
public coordinates: GeoJSON.Position[]; | ||
constructor(geoJson: GeoJSON.LineString); | ||
constructor(coordinates: Coordinates); | ||
type: "LineString"; | ||
coordinates: GeoJSON.Position[]; | ||
addVertex(coordinate: Coordinate): this; | ||
insertVertex(coordinate: Coordinate, index: number): this; | ||
removeVertex(index: number): this; | ||
public addVertex(coordinate: Coordinate): this; | ||
public insertVertex(coordinate: Coordinate, index: number): this; | ||
public removeVertex(index: number): this; | ||
} | ||
class MultiLineString extends Primitive<GeoJSON.MultiLineString> implements GeoJSON.MultiLineString { | ||
export class MultiLineString extends Primitive<GeoJSON.MultiLineString> implements GeoJSON.MultiLineString { | ||
public type: "MultiLineString"; | ||
public coordinates: Coordinate[][]; | ||
public forEach: (linestring: LineString, index: number, coordinates: Coordinates) => null; | ||
constructor(geoJson: GeoJSON.MultiLineString); | ||
constructor(coordinates: Coordinates[]); | ||
type: "MultiLineString"; | ||
coordinates: Coordinate[][]; | ||
forEach(f: Function) | ||
get(index: number): LineString | ||
public get(index: number): LineString | ||
} | ||
class Polygon extends Primitive<GeoJSON.Polygon> implements GeoJSON.Polygon { | ||
export class Polygon extends Primitive<GeoJSON.Polygon> implements GeoJSON.Polygon { | ||
public type: "Polygon"; | ||
public coordinates: Coordinate[][]; | ||
constructor(geoJson: GeoJSON.Polygon); | ||
constructor(coordinates: Coordinates[]) | ||
type: "Polygon"; | ||
coordinates: Coordinate[][]; | ||
addVertex(coordinate: Coordinate): this; | ||
insertVertex(coordinate: Coordinate, index: number): this; | ||
removeVertex(index: number): this; | ||
close(): this; | ||
hasHoles(): boolean; | ||
holes(): Polygon[] | ||
public addVertex(coordinate: Coordinate): this; | ||
public insertVertex(coordinate: Coordinate, index: number): this; | ||
public removeVertex(index: number): this; | ||
public close(): this; | ||
public hasHoles(): boolean; | ||
public holes(): Polygon[] | ||
} | ||
class MultiPolygon extends Primitive<GeoJSON.MultiPolygon> implements GeoJSON.MultiPolygon { | ||
export class MultiPolygon extends Primitive<GeoJSON.MultiPolygon> implements GeoJSON.MultiPolygon { | ||
public type: "MultiPolygon"; | ||
public coordinates: Coordinates[][]; | ||
public forEach: (polygon: Polygon, index: number, coordinates: Coordinates) => null; | ||
constructor(geoJson: GeoJSON.Polygon); | ||
@@ -89,12 +151,9 @@ constructor(geoJson: GeoJSON.MultiPolygon); | ||
constructor(coordinates: Coordinates[][]); | ||
type: "MultiPolygon"; | ||
coordinates: Coordinates[][]; | ||
forEach(f: Function) | ||
get(index: number): Polygon | ||
public get(index: number): Polygon | ||
} | ||
class Feature<T extends GeoJSON.GeometryObject> implements GeoJSON.Feature<T> { | ||
type: "Feature"; | ||
geometry: T | ||
properties: any; | ||
export class Feature<T extends GeoJSON.GeometryObject> implements GeoJSON.Feature<T> { | ||
public type: "Feature"; | ||
public geometry: T; | ||
public properties: any; | ||
constructor(geometry: T); | ||
@@ -104,57 +163,164 @@ constructor(geoJson: GeoJSON.Feature<T>); | ||
class FeatureCollection<T extends GeoJSON.GeometryObject> implements GeoJSON.FeatureCollection<T> { | ||
type: "FeatureCollection"; | ||
features: GeoJSON.Feature<T>[]; | ||
export class FeatureCollection<T extends GeoJSON.GeometryObject> implements GeoJSON.FeatureCollection<T> { | ||
public type: "FeatureCollection"; | ||
public features: Array<GeoJSON.Feature<T>>; | ||
public forEach: (feature: Feature<T>, index: number, coordinates: Coordinates) => null; | ||
constructor(geoJson: GeoJSON.FeatureCollection<T>); | ||
constructor(features: GeoJSON.Feature<T>[]); | ||
forEach(f: Function) | ||
get(index: number): Feature<T> | ||
constructor(features: Array<GeoJSON.Feature<T>>); | ||
public get(index: number): Feature<T> | ||
} | ||
class GeometryCollection implements GeoJSON.GeometryCollection { | ||
type: "GeometryCollection"; | ||
geometries: GeoJSON.GeometryObject[]; | ||
export class GeometryCollection implements GeoJSON.GeometryCollection { | ||
public type: "GeometryCollection"; | ||
public geometries: GeoJSON.GeometryObject[]; | ||
public forEach: (geometry: GeoJSON.GeometryObject, index: number, coordinates: Coordinates) => null; | ||
constructor(geoJson: GeoJSON.GeometryCollection); | ||
constructor(geoJson: GeoJSON.FeatureCollection<GeoJSON.GeometryObject>); | ||
constructor(features: GeoJSON.GeometryObject[]); | ||
forEach(f: Function) | ||
get(index: number): Primitive<GeoJSON.GeometryObject> | ||
public get(index: number): Primitive<GeoJSON.GeometryObject> | ||
} | ||
class Circle extends Primitive<GeoJSON.Feature<GeoJSON.Polygon>> implements GeoJSON.Feature<GeoJSON.Polygon> { | ||
type: "Feature"; | ||
geometry: GeoJSON.Polygon; | ||
properties: any; | ||
constructor(center: Coordinate, radius: number, steps: number); | ||
recalculate(): this; | ||
steps(steps?: number); | ||
radius(radius?: number); | ||
center(center?: Coordinate); | ||
/** | ||
* The GeoJSON spec does not provide a way to visualize circles. | ||
* Terraformer.Circle is actual a GeoJSON Feature object that contains a Polygon representing a circle with a certain number of sides. | ||
* @example | ||
* circle = new Terraformer.Circle([45.65, -122.27], 500, 64); | ||
* | ||
* circle.contains(point); | ||
*/ | ||
export class Circle extends Primitive<GeoJSON.Feature<GeoJSON.Polygon>> implements GeoJSON.Feature<GeoJSON.Polygon> { | ||
public type: "Feature"; | ||
public geometry: GeoJSON.Polygon; | ||
public properties: any; | ||
public steps: (steps?: number) => number; | ||
/** | ||
* Returns the radius circle. If the radius parameter is passed the circle will be recalculated witht he new radius before returning. | ||
*/ | ||
public radius: (radius?: number) => number; | ||
/** | ||
* Returns the center of the circle. If the center parameter is passed the circle will be recalculated with the new center before returning. | ||
*/ | ||
public center: (center?: Coordinate) => Coordinates; | ||
/** | ||
* Terraformer.Circle is created with a center, radius, and steps. | ||
* @param [center=null] Required A GeoJSON Coordinate in [x,y] format. | ||
* @param [radius=250] The radius of the circle in meters. | ||
* @param [steps=32] How many steps will be used to create the polygon that represents the circle. | ||
*/ | ||
constructor(center: Coordinate, radius?: number, steps?: number); | ||
/** | ||
* Recalculates the circle | ||
*/ | ||
public recalculate(): this; | ||
/** | ||
* Returns the number of steps to produce the polygon representing the circle. If the steps parameter is passed the circle will be recalculated witht he new step count before returning. | ||
*/ | ||
} | ||
class Tools { | ||
/** | ||
* Terraformer also has numerous helper methods for working with GeoJSON and geographic data. | ||
* These tools work with a mix of lower level GeoJSON constructs like Coordinates, | ||
* Coordinate Arrays and GeoJSON objects and Terraformer Primitives | ||
*/ | ||
export class Tools { | ||
// Spatial Reference Conversions | ||
/** | ||
* Converts this GeoJSON object’s coordinates to the web mercator spatial reference. This is an in-place modification of the passed object. | ||
* @param geojson GeoJSON object | ||
*/ | ||
public static toMercator(geojson: GeoJSON.GeoJsonObject): GeoJSON.GeoJsonObject; | ||
/** | ||
* Converts this GeoJSON object’s coordinates to geographic coordinates. This is an in-place modification of the passed object. | ||
* @param geojson GeoJSON object | ||
*/ | ||
public static toGeographic(geojson: GeoJSON.GeoJsonObject): GeoJSON.GeoJsonObject; | ||
/** | ||
* Runs the passed function against every Coordinate in the geojson object. Your function will be passed a Coordinate and will be expected to return a Coordinate. | ||
* @param geojson GeoJSON object | ||
* @param converter Function to convert one coordinate to a different coordinate. | ||
*/ | ||
public static applyConverter(geojson: GeoJSON.GeoJsonObject, converter: (coordinate: Coordinate) => Coordinate): GeoJSON.GeoJsonObject; | ||
/** | ||
* Converts the passed Coordinate to web mercator spatial reference. | ||
* @param coordinate Coordinate | ||
*/ | ||
public static positionToMercator(coordinate: Coordinate): Coordinate; | ||
/** | ||
* Converts the passed Coordinate to geographic coordinates. | ||
* @param coordinate Coordinate to convert | ||
*/ | ||
public static positionToGeographic(coordinate: Coordinate): Coordinate; | ||
static toMercator(geojson: GeoJSON.GeoJsonObject): GeoJSON.GeoJsonObject; | ||
static toGeographic(geojson: GeoJSON.GeoJsonObject): GeoJSON.GeoJsonObject; | ||
static applyConverter(geojson: GeoJSON.GeoJsonObject): GeoJSON.GeoJsonObject; | ||
static positionToMercator(coordinate: Coordinate): Coordinate; | ||
static positionToGeographic(coordinate: Coordinate): Coordinate; | ||
// Calculations | ||
static calculateBounds(geojson: GeoJSON.GeoJsonObject): BBox; | ||
static calculateEnvelope(geojson: GeoJSON.GeoJsonObject): Envelope; | ||
static convexHull(geojson: Coordinates): Coordinates; | ||
/** | ||
* Returns a GeoJSON bounding box for the passed geoJSON. | ||
* @param geojson | ||
*/ | ||
public static calculateBounds(geojson: GeoJSON.GeoJsonObject): BBox; | ||
/** | ||
* Returns an object with x, y, w, h. Suitable for passing to most indexes. | ||
* @param geojson | ||
*/ | ||
public static calculateEnvelope(geojson: GeoJSON.GeoJsonObject): Envelope; | ||
/** | ||
* Returns an array of coordinates representing the convex hull the the passed geoJSON. | ||
* @param geojson | ||
*/ | ||
public static convexHull(geojson: Coordinates): Coordinates; | ||
// Comparisons | ||
static coordinatesContainPoint(coordinates: Coordinates[], coordinate: Coordinate): Boolean; | ||
static polygonContainsPoint(polygon: GeoJSON.Polygon, coordinate: Coordinate): Boolean; | ||
static polygonContainsPoint(polygon: GeoJSON.Position[][], coordinate: Coordinate): Boolean; | ||
static arrayIntersectsArray(c1: Coordinates[], c2: Coordinates[]): Boolean; | ||
static coordinatesEqual(c1: Coordinate, c2: Coordinate): Boolean; | ||
/** | ||
* Accepts an array of coordinates and a coordinate and returns true if the point falls within the coordinate array. | ||
* @param coordinates Array of coordinates | ||
* @param coordinate Coordinate that will be searched for in the array. | ||
*/ | ||
public static coordinatesContainPoint(coordinates: Coordinates[], coordinate: Coordinate): Boolean; | ||
/** | ||
* Accepts the geometry of a polygon and a coordinate and returns true if the point falls within the polygon. | ||
* @param polygon | ||
* @param coordinate | ||
*/ | ||
public static polygonContainsPoint(polygon: GeoJSON.Polygon, coordinate: Coordinate): Boolean; | ||
/** | ||
* Accepts the geometry of a polygon and a coordinate and returns true if the point falls within the polygon. | ||
* @param polygon | ||
* @param coordinate | ||
*/ | ||
public static polygonContainsPoint(polygon: GeoJSON.Position[][], coordinate: Coordinate): Boolean; | ||
/** | ||
* Accepts two arrays of coordinates and returns true if they cross each other at any point. | ||
* @param c1 | ||
* @param c2 | ||
* @example | ||
* var pt = [0,0]; | ||
* var pt2 = [-111.873779, 40.647303]; | ||
* | ||
* var polygon = { | ||
* "type": "Polygon", | ||
* "coordinates": [[ | ||
* [-112.074279, 40.52215], | ||
* [-112.074279, 40.853293], | ||
* [-111.610107, 40.853293], | ||
* [-111.610107, 40.52215], | ||
* [-112.074279, 40.52215] | ||
* ]] | ||
* }; | ||
* | ||
* var polygonGeometry = polygon.coordinates; | ||
* | ||
* Terraformer.Tools.polygonContainsPoint(polygonGeometry, pt); | ||
* // returns false | ||
* Terraformer.Tools.polygonContainsPoint(polygonGeometry, pt2); | ||
* // returns true | ||
*/ | ||
public static arrayIntersectsArray(c1: Coordinates[], c2: Coordinates[]): Boolean; | ||
/** | ||
* Accepts two individual coordinate pairs and returns true if the passed coordinate pairs are equal to each other. | ||
* @param c1 | ||
* @param c2 | ||
*/ | ||
public static coordinatesEqual(c1: Coordinate, c2: Coordinate): Boolean; | ||
} | ||
} | ||
export = Terraformer; |
40
test.ts
@@ -1,2 +0,2 @@ | ||
import Terraformer = require("./terraformer"); | ||
import * as Terraformer from "./terraformer"; | ||
@@ -24,3 +24,2 @@ console.assert(typeof Terraformer !== undefined); | ||
let linestring = new Terraformer.LineString({ | ||
@@ -40,6 +39,5 @@ type: "LineString", | ||
let polygon1 = new Terraformer.Polygon({ | ||
"type": "Polygon", | ||
"coordinates": [ | ||
type: "Polygon", | ||
coordinates: [ | ||
[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]], | ||
@@ -56,4 +54,4 @@ [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]] | ||
let multipolygon1 = new Terraformer.MultiPolygon({ | ||
"type": "MultiPolygon", | ||
"coordinates": [[ | ||
type: "MultiPolygon", | ||
coordinates: [[ | ||
[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]], | ||
@@ -70,7 +68,7 @@ [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]] | ||
let feature1 = new Terraformer.Feature<GeoJSON.Polygon>({ | ||
"type": "Feature", | ||
"properties": null, | ||
"geometry": { | ||
"type": "Polygon", | ||
"coordinates": [ | ||
type: "Feature", | ||
properties: null, | ||
geometry: { | ||
type: "Polygon", | ||
coordinates: [ | ||
[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]], | ||
@@ -83,4 +81,4 @@ [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]] | ||
let feature2 = new Terraformer.Feature({ | ||
"type": "Polygon", | ||
"coordinates": [ | ||
type: "Polygon", | ||
coordinates: [ | ||
[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]], | ||
@@ -92,4 +90,4 @@ [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]] | ||
let featurecollection1 = new Terraformer.FeatureCollection({ | ||
"type": "FeatureCollection", | ||
"features": [feature1, feature2] | ||
type: "FeatureCollection", | ||
features: [feature1, feature2] | ||
}); | ||
@@ -100,4 +98,4 @@ | ||
let geometrycollection1 = new Terraformer.GeometryCollection({ | ||
"type": "GeometryCollection", | ||
"geometries": [point2, polygon1] | ||
type: "GeometryCollection", | ||
geometries: [point2, polygon1] | ||
}); | ||
@@ -115,4 +113,4 @@ | ||
let polygon = { | ||
"type": "Polygon", | ||
"coordinates": [[ | ||
type: "Polygon", | ||
coordinates: [[ | ||
[-112.074279, 40.52215], | ||
@@ -131,2 +129,2 @@ [-112.074279, 40.853293], | ||
Terraformer.Tools.polygonContainsPoint(polygonGeometry, pt2); | ||
// returns true | ||
// returns true |
@@ -5,3 +5,4 @@ { | ||
"target": "es5", | ||
"noImplicitAny": false, | ||
"noImplicitAny": true, | ||
"strictNullChecks": true, | ||
"sourceMap": false | ||
@@ -12,2 +13,2 @@ }, | ||
] | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 77 instances in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
1
0
992329
1
15
68
4187
+ Added@types/geojson@^1.0.0
+ Added@types/geojson@1.0.6(transitive)