@types/geojson
Advanced tools
Comparing version 1.0.6 to 7946.0.0
@@ -1,39 +0,78 @@ | ||
// Type definitions for GeoJSON Format Specification Revision 1.0 | ||
// Project: http://geojson.org/ | ||
// Type definitions for geojson 7946.0 | ||
// Project: https://geojson.org/ | ||
// Definitions by: Jacob Bruun <https://github.com/cobster> | ||
// Arne Schubert <https://github.com/atd-schubert> | ||
// Jeff Jacobson <https://github.com/JeffJacobson> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
// TypeScript Version: 2.3 | ||
// Note: as of the RFC 7946 version of GeoJSON, Coordinate Reference Systems | ||
// are no longer supported. (See https://tools.ietf.org/html/rfc7946#appendix-B)} | ||
export as namespace GeoJSON; | ||
/*** | ||
* http://geojson.org/geojson-spec.html#geojson-objects | ||
/** | ||
* The valid values for the "type" property of GeoJSON geometry objects. | ||
* https://tools.ietf.org/html/rfc7946#section-1.4 | ||
*/ | ||
export interface GeoJsonObject { | ||
type: string; | ||
bbox?: number[]; | ||
crs?: CoordinateReferenceSystem; | ||
} | ||
export type GeoJsonGeometryTypes = "Point" | "LineString" | "MultiPoint" | "Polygon" | "MultiLineString" | | ||
"MultiPolygon" | "GeometryCollection"; | ||
/*** | ||
* http://geojson.org/geojson-spec.html#positions | ||
/** | ||
* The value values for the "type" property of GeoJSON Objects. | ||
* https://tools.ietf.org/html/rfc7946#section-1.4 | ||
*/ | ||
export type Position = number[]; | ||
export type GeoJsonTypes = "FeatureCollection" | "Feature" | GeoJsonGeometryTypes; | ||
/*** | ||
* http://geojson.org/geojson-spec.html#geometry-objects | ||
/** | ||
* Bounding box | ||
* https://tools.ietf.org/html/rfc7946#section-5 | ||
*/ | ||
export interface DirectGeometryObject extends GeoJsonObject { | ||
coordinates: Position[][][] | Position[][] | Position[] | Position; | ||
export type BBox = [number, number, number, number] | [number, number, number, number, number, number]; | ||
/** | ||
* A Position is an array of coordinates. | ||
* https://tools.ietf.org/html/rfc7946#section-3.1.1 | ||
* Array should contain between two and three elements. | ||
* The previous GeoJSON specification allowed more elements (e.g., which could be used to represent M values), | ||
* but the current specification only allows X, Y, and (optionally) Z to be defined. | ||
*/ | ||
export type Position = number[]; // [number, number] | [number, number, number]; | ||
/** | ||
* The base GeoJSON object. | ||
* https://tools.ietf.org/html/rfc7946#section-3 | ||
* The GeoJSON specification also allows foreign members | ||
* (https://tools.ietf.org/html/rfc7946#section-6.1) | ||
* Developers should use "&" type in TypeScript or extend the interface | ||
* to add these foreign members. | ||
*/ | ||
export interface GeoJsonObject { | ||
// Don't include foreign members directly into this type def. | ||
// in order to preserve type safety. | ||
// [key: string]: any; | ||
/** | ||
* Specifies the type of GeoJSON object. | ||
*/ | ||
type: GeoJsonTypes; | ||
/** | ||
* Bounding box of the coordinate range of the object's Geometries, Features, or Feature Collections. | ||
* https://tools.ietf.org/html/rfc7946#section-5 | ||
*/ | ||
bbox?: BBox; | ||
} | ||
/** | ||
* GeometryObject supports geometry collection as well | ||
* A geometry object. | ||
* https://tools.ietf.org/html/rfc7946#section-3 | ||
*/ | ||
export type GeometryObject = DirectGeometryObject | GeometryCollection; | ||
export interface GeometryObject extends GeoJsonObject { | ||
type: GeoJsonGeometryTypes; | ||
} | ||
/*** | ||
* http://geojson.org/geojson-spec.html#point | ||
/** | ||
* Point geometry object. | ||
* https://tools.ietf.org/html/rfc7946#section-3.1.2 | ||
*/ | ||
export interface Point extends DirectGeometryObject { | ||
export interface Point extends GeometryObject { | ||
type: "Point"; | ||
@@ -43,6 +82,7 @@ coordinates: Position; | ||
/*** | ||
* http://geojson.org/geojson-spec.html#multipoint | ||
/** | ||
* MultiPoint geometry object. | ||
* https://tools.ietf.org/html/rfc7946#section-3.1.3 | ||
*/ | ||
export interface MultiPoint extends DirectGeometryObject { | ||
export interface MultiPoint extends GeometryObject { | ||
type: "MultiPoint"; | ||
@@ -52,6 +92,7 @@ coordinates: Position[]; | ||
/*** | ||
* http://geojson.org/geojson-spec.html#linestring | ||
/** | ||
* LineString geometry object. | ||
* https://tools.ietf.org/html/rfc7946#section-3.1.4 | ||
*/ | ||
export interface LineString extends DirectGeometryObject { | ||
export interface LineString extends GeometryObject { | ||
type: "LineString"; | ||
@@ -61,6 +102,7 @@ coordinates: Position[]; | ||
/*** | ||
* http://geojson.org/geojson-spec.html#multilinestring | ||
/** | ||
* MultiLineString geometry object. | ||
* https://tools.ietf.org/html/rfc7946#section-3.1.5 | ||
*/ | ||
export interface MultiLineString extends DirectGeometryObject { | ||
export interface MultiLineString extends GeometryObject { | ||
type: "MultiLineString"; | ||
@@ -70,6 +112,7 @@ coordinates: Position[][]; | ||
/*** | ||
* http://geojson.org/geojson-spec.html#polygon | ||
/** | ||
* Polygon geometry object. | ||
* https://tools.ietf.org/html/rfc7946#section-3.1.6 | ||
*/ | ||
export interface Polygon extends DirectGeometryObject { | ||
export interface Polygon extends GeometryObject { | ||
type: "Polygon"; | ||
@@ -79,6 +122,7 @@ coordinates: Position[][]; | ||
/*** | ||
* http://geojson.org/geojson-spec.html#multipolygon | ||
/** | ||
* MultiPolygon geometry object. | ||
* https://tools.ietf.org/html/rfc7946#section-3.1.7 | ||
*/ | ||
export interface MultiPolygon extends DirectGeometryObject { | ||
export interface MultiPolygon extends GeometryObject { | ||
type: "MultiPolygon"; | ||
@@ -88,42 +132,40 @@ coordinates: Position[][][]; | ||
/*** | ||
* http://geojson.org/geojson-spec.html#geometry-collection | ||
/** | ||
* Geometry Collection | ||
* https://tools.ietf.org/html/rfc7946#section-3.1.8 | ||
*/ | ||
export interface GeometryCollection extends GeoJsonObject { | ||
export interface GeometryCollection extends GeometryObject { | ||
type: "GeometryCollection"; | ||
geometries: GeometryObject[]; | ||
geometries: Array<Point | LineString | Polygon | MultiPoint | MultiLineString | MultiPolygon>; | ||
} | ||
/*** | ||
export type GeoJsonProperties = { [name: string]: any; } | null; | ||
/** | ||
* A feature object which contains a geometry and associated properties. | ||
* https://tools.ietf.org/html/rfc7946#section-3.2 | ||
*/ | ||
export interface Feature<G extends GeometryObject, P = any> extends GeoJsonObject { | ||
export interface Feature<G extends GeometryObject, P = GeoJsonProperties> extends GeoJsonObject { | ||
type: "Feature"; | ||
geometry: G; | ||
properties: P; | ||
/** | ||
* The feature's geometry | ||
*/ | ||
geometry: G | null; | ||
/** | ||
* A value that uniquely identifies this feature in a | ||
* https://tools.ietf.org/html/rfc7946#section-3.2. | ||
*/ | ||
id?: string | number; | ||
/** | ||
* Properties associated with this feature. | ||
*/ | ||
properties: P | null; | ||
} | ||
/*** | ||
* http://geojson.org/geojson-spec.html#feature-collection-objects | ||
/** | ||
* A collection of feature objects. | ||
* https://tools.ietf.org/html/rfc7946#section-3.3 | ||
*/ | ||
export interface FeatureCollection<G extends GeometryObject, P = any> extends GeoJsonObject { | ||
type: "FeatureCollection"; | ||
export interface FeatureCollection<G extends GeometryObject, P = GeoJsonProperties> extends GeoJsonObject { | ||
features: Array<Feature<G, P>>; | ||
} | ||
/*** | ||
* http://geojson.org/geojson-spec.html#coordinate-reference-system-objects | ||
*/ | ||
export interface CoordinateReferenceSystem { | ||
type: string; | ||
properties: any; | ||
} | ||
export interface NamedCoordinateReferenceSystem extends CoordinateReferenceSystem { | ||
properties: { name: string }; | ||
} | ||
export interface LinkedCoordinateReferenceSystem extends CoordinateReferenceSystem { | ||
properties: { href: string; type: string }; | ||
} |
{ | ||
"name": "@types/geojson", | ||
"version": "1.0.6", | ||
"description": "TypeScript definitions for GeoJSON Format Specification Revision", | ||
"version": "7946.0.0", | ||
"description": "TypeScript definitions for geojson", | ||
"license": "MIT", | ||
@@ -16,2 +16,7 @@ "contributors": [ | ||
"githubUsername": "atd-schubert" | ||
}, | ||
{ | ||
"name": "Jeff Jacobson", | ||
"url": "https://github.com/JeffJacobson", | ||
"githubUsername": "JeffJacobson" | ||
} | ||
@@ -26,4 +31,4 @@ ], | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "2a374692a48615d90fde45b274e247a1ec98647d93fe7c7ee355386108689bcd", | ||
"typesPublisherContentHash": "d38990ffbb682c151e95fde92042fd584acace1bf58fd74269f5ee1b0f185368", | ||
"typeScriptVersion": "2.3" | ||
} |
@@ -5,3 +5,3 @@ # Installation | ||
# Summary | ||
This package contains type definitions for GeoJSON Format Specification Revision (http://geojson.org/). | ||
This package contains type definitions for geojson (https://geojson.org/). | ||
@@ -12,3 +12,3 @@ # Details | ||
Additional Details | ||
* Last updated: Wed, 01 Nov 2017 15:55:40 GMT | ||
* Last updated: Tue, 28 Nov 2017 00:57:50 GMT | ||
* Dependencies: none | ||
@@ -18,2 +18,2 @@ * Global values: GeoJSON | ||
# Credits | ||
These definitions were written by Jacob Bruun <https://github.com/cobster>, Arne Schubert <https://github.com/atd-schubert>. | ||
These definitions were written by Jacob Bruun <https://github.com/cobster>, Arne Schubert <https://github.com/atd-schubert>, Jeff Jacobson <https://github.com/JeffJacobson>. |
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
7803
147