{"_id":"gjtk","_rev":"209351","name":"gjtk","description":"GeoJSON ToolKit","dist-tags":{"beta":"1.0.0-b","latest":"2.0.0"},"maintainers":[{"name":"dmtucker","email":"david.michael.tucker@gmail.com"}],"time":{"modified":"2021-06-03T15:25:08.000Z","created":"2014-06-01T08:11:54.924Z","2.0.0":"2015-07-31T09:42:09.541Z","1.0.3-beta":"2015-07-09T08:22:29.882Z","1.0.2-beta":"2015-07-09T08:10:52.080Z","1.0.1-beta":"2015-07-09T07:04:40.991Z","1.0.0-b":"2014-06-01T08:11:54.924Z"},"users":{},"author":{"name":"David Tucker","email":"david.michael.tucker@gmail.com"},"repository":{"type":"git","url":"git://github.com/dmtucker/gjtk-js.git"},"versions":{"2.0.0":{"name":"gjtk","version":"2.0.0","description":"GeoJSON ToolKit","main":"gjtk.js","scripts":{"test":"mocha"},"repository":{"type":"git","url":"git://github.com/dmtucker/gjtk-js.git"},"keywords":["geojson","toolkit"],"author":{"name":"David Tucker","email":"david.michael.tucker@gmail.com"},"license":"GPL","bugs":{"url":"https://github.com/dmtucker/gjtk-js/issues"},"homepage":"https://github.com/dmtucker/gjtk-js","dependencies":{"point-in-polygon":"^1.0.0","uri-js":"^2.1.0"},"devDependencies":{"mocha":"^2.2.5"},"_id":"gjtk@2.0.0","_shasum":"7b4c94190738aea796bbe113ebe85e58279de554","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"dmtucker","email":"david.michael.tucker@gmail.com"},"maintainers":[{"name":"dmtucker","email":"david.michael.tucker@gmail.com"}],"dist":{"shasum":"7b4c94190738aea796bbe113ebe85e58279de554","size":20008,"noattachment":false,"key":"/gjtk/-/gjtk-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/gjtk/download/gjtk-2.0.0.tgz"},"directories":{},"publish_time":1438335729541,"_cnpm_publish_time":1438335729541,"_hasShrinkwrap":false},"1.0.3-beta":{"name":"gjtk","version":"1.0.3-beta","description":"GeoJSON ToolKit","main":"GeoJSON.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/dmtucker/gjtk-js.git"},"keywords":["geojson","toolkit"],"author":{"name":"David Tucker","email":"david.michael.tucker@gmail.com"},"license":"GPL","bugs":{"url":"https://github.com/dmtucker/gjtk-js/issues"},"homepage":"https://github.com/dmtucker/gjtk-js","dependencies":{"point-in-polygon":"^0.0.0","uri-js":"^2.1.0"},"_id":"gjtk@1.0.3-beta","_shasum":"572a1d8e5fb14510728309275734084fa3f39946","_from":"./","_npmVersion":"1.4.9","_npmUser":{"name":"dmtucker","email":"david.michael.tucker@gmail.com"},"maintainers":[{"name":"dmtucker","email":"david.michael.tucker@gmail.com"}],"dist":{"shasum":"572a1d8e5fb14510728309275734084fa3f39946","size":17177,"noattachment":false,"key":"/gjtk/-/gjtk-1.0.3-beta.tgz","tarball":"http://registry.cnpm.dingdandao.com/gjtk/download/gjtk-1.0.3-beta.tgz"},"directories":{},"publish_time":1436430149882,"_cnpm_publish_time":1436430149882,"_hasShrinkwrap":false},"1.0.2-beta":{"name":"gjtk","version":"1.0.2-beta","description":"GeoJSON ToolKit","main":"GeoJSON.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/dmtucker/gjtk-js.git"},"keywords":["geojson","toolkit"],"author":{"name":"David Tucker","email":"david.michael.tucker@gmail.com"},"license":"GPL","bugs":{"url":"https://github.com/dmtucker/gjtk-js/issues"},"homepage":"https://github.com/dmtucker/gjtk-js","dependencies":{"point-in-polygon":"^0.0.0","uri-js":"^2.1.0"},"_id":"gjtk@1.0.2-beta","_shasum":"be7af2cd1f8847c7ac33a350fa70a48755477a1d","_from":"./","_npmVersion":"1.4.9","_npmUser":{"name":"dmtucker","email":"david.michael.tucker@gmail.com"},"maintainers":[{"name":"dmtucker","email":"david.michael.tucker@gmail.com"}],"dist":{"shasum":"be7af2cd1f8847c7ac33a350fa70a48755477a1d","size":17250,"noattachment":false,"key":"/gjtk/-/gjtk-1.0.2-beta.tgz","tarball":"http://registry.cnpm.dingdandao.com/gjtk/download/gjtk-1.0.2-beta.tgz"},"directories":{},"publish_time":1436429452080,"_cnpm_publish_time":1436429452080,"_hasShrinkwrap":false},"1.0.1-beta":{"name":"gjtk","version":"1.0.1-beta","description":"GeoJSON ToolKit","main":"GeoJSON.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/dmtucker/gjtk-js.git"},"keywords":["geojson","toolkit"],"author":{"name":"David Tucker","email":"david.michael.tucker@gmail.com"},"license":"GPL","bugs":{"url":"https://github.com/dmtucker/gjtk-js/issues"},"homepage":"https://github.com/dmtucker/gjtk-js","dependencies":{"point-in-polygon":"^0.0.0","uri-js":"^2.1.0"},"_id":"gjtk@1.0.1-beta","_shasum":"307cc2acf5cdd577e27cdee86424a0e75b608cba","_from":"./","_npmVersion":"1.4.9","_npmUser":{"name":"dmtucker","email":"david.michael.tucker@gmail.com"},"maintainers":[{"name":"dmtucker","email":"david.michael.tucker@gmail.com"}],"dist":{"shasum":"307cc2acf5cdd577e27cdee86424a0e75b608cba","size":17344,"noattachment":false,"key":"/gjtk/-/gjtk-1.0.1-beta.tgz","tarball":"http://registry.cnpm.dingdandao.com/gjtk/download/gjtk-1.0.1-beta.tgz"},"directories":{},"publish_time":1436425480991,"_cnpm_publish_time":1436425480991,"_hasShrinkwrap":false},"1.0.0-b":{"name":"gjtk","version":"1.0.0-b","description":"GeoJSON ToolKit","main":"GeoJSON.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/dmtucker/gjtk-js.git"},"keywords":["geojson","toolkit"],"author":{"name":"David Tucker","email":"david.michael.tucker@gmail.com"},"license":"GPL","bugs":{"url":"https://github.com/dmtucker/gjtk-js/issues"},"homepage":"https://github.com/dmtucker/gjtk-js","dependencies":{"point-in-polygon":"^0.0.0","uri-js":"^1.4.2"},"_id":"gjtk@1.0.0-b","_shasum":"14f5c59b4ecb697bc5f28d188e4c162dd93cf86d","_from":"./","_npmVersion":"1.4.9","_npmUser":{"name":"dmtucker","email":"david.michael.tucker@gmail.com"},"maintainers":[{"name":"dmtucker","email":"david.michael.tucker@gmail.com"}],"dist":{"shasum":"14f5c59b4ecb697bc5f28d188e4c162dd93cf86d","size":15245,"noattachment":false,"key":"/gjtk/-/gjtk-1.0.0-b.tgz","tarball":"http://registry.cnpm.dingdandao.com/gjtk/download/gjtk-1.0.0-b.tgz"},"directories":{},"publish_time":1401610314924,"_cnpm_publish_time":1401610314924,"_hasShrinkwrap":false}},"readme":"# GeoJSON ToolKit\n\n`gjtk` is a library for working with [GeoJSON](http://geojson.org/).\n\n[![Build Status](https://img.shields.io/codeship/f753ffc0-0912-0133-16ea-4a4c0ecd07c2/master.svg)](https://codeship.com/projects/90449)\n[![Dependency Status](https://img.shields.io/david/dmtucker/gjtk-js.svg)](https://david-dm.org/dmtucker/gjtk-js)\n[![NPM Version](https://img.shields.io/npm/v/gjtk.svg)](https://www.npmjs.com/package/gjtk)\n\n## Installation\n`gjtk` is available on [npm](//www.npmjs.com/package/gjtk).\n``` sh\nnpm install gjtk\n```\n\n## Usage\n``` js\nvar gjtk = require('gjtk');\n```\n\n## Validation Methods\n\nAll validation methods take a single argument.\n\n### isGeoJSON\nreturns `true` when passed a valid [GeoJSON object](http://geojson.org/geojson-spec.html#geojson-objects), otherwise `false`\n\n> GeoJSON always consists of a single object. This object (referred to as the GeoJSON object [above]) represents a geometry, feature, or collection of features.\n\n### isGeometry\nreturns `true` when passed a valid [GeoJSON Geometry](http://geojson.org/geojson-spec.html#geometry-objects), otherwise `false`\n\n> A geometry is a GeoJSON object where the type member's value is one of the following strings: \"Point\", \"MultiPoint\", \"LineString\", \"MultiLineString\", \"Polygon\", \"MultiPolygon\", or \"GeometryCollection\".\n\n### isPosition\nreturns `true` when passed a valid [GeoJSON Position](http://geojson.org/geojson-spec.html#positions), otherwise `false`\n\n> A position is represented by an array of numbers. There must be at least two elements, and may be more. The order of elements must follow x, y, z order (easting, northing, altitude for coordinates in a projected coordinate reference system, or longitude, latitude, altitude for coordinates in a geographic coordinate reference system). Any number of additional elements are allowed -- interpretation and meaning of additional elements is beyond the scope of this specification.\n\n### isPointCoordinates\nreturns `true` when passed valid [GeoJSON Point](http://geojson.org/geojson-spec.html#point) coordinates, otherwise `false`\n\n#### example\n``` json\n[100.0, 0.0]\n```\n\n### isMultiPointCoordinates\nreturns `true` when passed valid [GeoJSON MultiPoint](http://geojson.org/geojson-spec.html#multipoint) coordinates, otherwise `false`\n\n#### example\n``` json\n[ [100.0, 0.0], [101.0, 1.0], [102.0, 2.0] ]\n```\n\n### isLineStringCoordinates\nreturns `true` when passed valid [GeoJSON LineString](http://geojson.org/geojson-spec.html#linestring) coordinates, otherwise `false`\n\n#### example\n``` json\n[ [100.0, 0.0], [101.0, 1.0] ]\n```\n\n### isLinearRingCoordinates\nreturns `true` when passed valid [GeoJSON LinearRing](http://geojson.org/geojson-spec.html#linestring) coordinates, otherwise `false`\n\n> A LinearRing is closed LineString with 4 or more positions. The first and last positions are equivalent (they represent equivalent points). Though a LinearRing is not explicitly represented as a GeoJSON geometry type, it is referred to in the Polygon geometry type definition.\n\n#### example\n``` json\n[ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ]\n```\n\n### isMultiLineStringCoordinates\nreturns `true` when passed valid [GeoJSON MultiLineString](http://geojson.org/geojson-spec.html#multilinestring) coordinates, otherwise `false`\n\n#### example\n``` json\n[\n  [ [100.0, 0.0], [101.0, 1.0] ],\n  [ [102.0, 2.0], [103.0, 3.0] ]\n]\n```\n\n### isPolygonCoordinates\nreturns `true` when passed valid [GeoJSON Polygon](http://geojson.org/geojson-spec.html#polygon) coordinates, otherwise `false`\n\n#### example\n* 0 holes\n``` json\n[\n  [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ]\n]\n```\n* 1 hole\n``` json\n[\n  [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ],\n  [ [100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2] ]\n]\n```\n* etc.\n\n### isMultiPolygonCoordinates\nreturns `true` when passed valid [GeoJSON MultiPolygon](http://geojson.org/geojson-spec.html#multipolygon) coordinates, otherwise `false`\n\n#### example\n``` json\n[\n  [\n    [ [102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0] ]\n  ],\n  [\n    [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ],\n    [ [100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2] ]\n  ]\n]\n```\n\n### isPoint\nreturns `true` when passed a valid [GeoJSON Point](http://geojson.org/geojson-spec.html#point), otherwise `false`\n\n#### example\n``` json\n{ \"type\": \"Point\", \"coordinates\": [100.0, 0.0] }\n```\n\n### isMultiPoint\nreturns `true` when passed a valid [GeoJSON MultiPoint](http://geojson.org/geojson-spec.html#multipoint), otherwise `false`\n\n#### example\n``` json\n{ \"type\": \"MultiPoint\", \"coordinates\": [ [100.0, 0.0], [101.0, 1.0] ] }\n```\n\n### isLineString\nreturns `true` when passed a valid [GeoJSON LineString](http://geojson.org/geojson-spec.html#linestring), otherwise `false`\n\n#### example\n``` json\n{\n  \"type\": \"LineString\",\n  \"coordinates\": [ [100.0, 0.0], [101.0, 1.0] ]\n}\n```\n\n### isMultiLineString\nreturns `true` when passed a valid [GeoJSON MultiLineString](http://geojson.org/geojson-spec.html#multilinestring), otherwise `false`\n\n#### example\n``` json\n{\n  \"type\": \"MultiLineString\",\n  \"coordinates\": [\n    [ [100.0, 0.0], [101.0, 1.0] ],\n    [ [102.0, 2.0], [103.0, 3.0] ]\n  ]\n}\n```\n\n### isPolygon\nreturns `true` when passed a valid [GeoJSON Polygon](http://geojson.org/geojson-spec.html#polygon), otherwise `false`\n\n#### example\n* 0 holes\n``` json\n{\n  \"type\": \"Polygon\",\n  \"coordinates\": [\n    [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ]\n  ]\n}\n```\n* 1 hole\n``` json\n{\n  \"type\": \"Polygon\",\n  \"coordinates\": [\n    [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ],\n    [ [100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2] ]\n  ]\n}\n```\n* etc.\n\n### isMultiPolygon\nreturns `true` when passed a valid [GeoJSON MultiPolygon](http://geojson.org/geojson-spec.html#multipolygon), otherwise `false`\n\n#### example\n``` json\n{\n  \"type\": \"MultiPolygon\",\n  \"coordinates\": [\n    [\n      [ [102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0] ]\n    ],\n    [\n      [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ],\n      [ [100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2] ]\n    ]\n  ]\n}\n```\n\n### isGeometryCollection\nreturns `true` when passed a valid [GeoJSON Geometry Collection](http://geojson.org/geojson-spec.html#geometry-collection), otherwise `false`\n\n#### example\n``` json\n{\n  \"type\": \"GeometryCollection\",\n  \"geometries\": [\n    {\n      \"type\": \"Point\",\n      \"coordinates\": [100.0, 0.0]\n    },\n    {\n      \"type\": \"LineString\",\n      \"coordinates\": [ [101.0, 0.0], [102.0, 1.0] ]\n    }\n  ]\n}\n```\n\n### isFeature\nreturns `true` when passed a valid [GeoJSON Feature](http://geojson.org/geojson-spec.html#feature-objects), otherwise `false`\n\n#### example\n``` json\n{\n  \"type\": \"Feature\",\n  \"geometry\": {\n    \"type\": \"Point\",\n    \"coordinates\": [125.6, 10.1]\n  },\n  \"properties\": {\n    \"name\": \"Dinagat Islands\"\n  }\n}\n```\n\n### isFeatureCollection\nreturns `true` when passed a valid [GeoJSON Feature Collection](http://geojson.org/geojson-spec.html#feature-collection-objects), otherwise `false`\n\n#### example\n``` json\n{\n  \"type\": \"FeatureCollection\",\n  \"features\": [\n    {\n      \"type\": \"Feature\",\n      \"geometry\": {\n        \"type\": \"Point\",\n        \"coordinates\": [102.0, 0.5]\n      },\n      \"properties\": {\n        \"prop0\": \"value0\"\n      }\n    },\n    {\n      \"type\": \"Feature\",\n      \"geometry\": {\n        \"type\": \"LineString\",\n        \"coordinates\": [ [102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0] ]\n      },\n      \"properties\": {\n        \"prop0\": \"value0\",\n        \"prop1\": 0.0\n      }\n    },\n    {\n      \"type\": \"Feature\",\n      \"geometry\": {\n        \"type\": \"Polygon\",\n        \"coordinates\": [\n          [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ]\n        ]\n      },\n      \"properties\": {\n        \"prop0\": \"value0\",\n        \"prop1\": {\n          \"this\": \"that\"\n        }\n      }\n    }\n  ]\n}\n```\n\n### isCRS\nreturns `true` when passed a valid [GeoJSON Coordinate Reference System](http://geojson.org/geojson-spec.html#coordinate-reference-system-objects), otherwise `false`\n\n#### example\n* [Named CRS](http://geojson.org/geojson-spec.html#named-crs)\n``` json\n{\n  \"type\": \"name\",\n  \"properties\": {\n    \"name\": \"urn:ogc:def:crs:OGC:1.3:CRS84\"\n  }\n}\n```\n* [Linked CRS](http://geojson.org/geojson-spec.html#linked-crs)\n``` json\n{\n  \"type\": \"link\", \n  \"properties\": {\n    \"href\": \"http://example.com/crs/42\",\n    \"type\": \"proj4\"\n  }\n}\n```\n\n### hasCRS\nreturns `true` when passed an object that validly specifies a [GeoJSON Coordinate Reference System](http://geojson.org/geojson-spec.html#coordinate-reference-system-objects), otherwise `false`\n\n> The coordinate reference system (CRS) of a GeoJSON object is determined by its \"crs\" member (referred to as the CRS object below). If an object has no crs member, then its parent or grandparent object's crs member may be acquired. If no crs member can be so acquired, the default CRS shall apply to the GeoJSON object.\n\n### isLink\nreturns `true` when passed a valid [GeoJSON Link](http://geojson.org/geojson-spec.html#link-objects), otherwise `false`\n\n#### example\n``` json\n{\n  \"type\": \"link\",\n  \"properties\": {\n    \"href\": \"data.crs\",\n    \"type\": \"ogcwkt\"\n  }\n}\n```\n\n### isBbox (not implemented)\nreturns `true` when passed a valid [GeoJSON Bounding Box](http://geojson.org/geojson-spec.html#bounding-boxes), otherwise `false`\n\n#### example\n``` json\n[-180.0, -90.0, 180.0, 90.0]\n```\n\n### hasBbox (partially implemented)\nreturns `true` when passed an object that validly specifies a [GeoJSON Bounding Box](http://geojson.org/geojson-spec.html#bounding-boxes), otherwise `false`\n\n#### example\n``` json\n{\n  \"type\": \"Feature\",\n  \"bbox\": [-180.0, -90.0, 180.0, 90.0],\n  \"geometry\": {\n    \"type\": \"Polygon\",\n    \"coordinates\": [\n      [ [-180.0, 10.0], [20.0, 90.0], [180.0, -5.0], [-30.0, -90.0] ]\n    ]\n  }\n}\n```\n\n## Utility Methods\n\n### Comparison\n\n#### equalPositions(_position1_, _position2_)\nreturns `true` when all parameters are identical [GeoJSON Positions](http://geojson.org/geojson-spec.html#positions), otherwise `false`\n\n#### containedPolygon(_innerLinearRing_, _outerLinearRing_)\nreturns `true` when one [GeoJSON LinearRing](http://geojson.org/geojson-spec.html#linestring) contains another, otherwise `false`\n\n### Templates\n\n#### Point(_Position_)\nreturns a [GeoJSON Point](http://geojson.org/geojson-spec.html#point) object\n\n#### Feature(_Geometry_, _properties_)\nreturns a [GeoJSON Feature](http://geojson.org/geojson-spec.html#feature-objects) object\n\n#### FeatureCollection(_Features_)\nreturns a [GeoJSON FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects) object\n\n#### GeometryCollection(_Geometries_)\nreturns a [GeoJSON GeometryCollection](http://geojson.org/geojson-spec.html#geometry-collection) object\n\n### Extraction\n\nThese methods all take a single argument: a valid [GeoJSON object](http://geojson.org/geojson-spec.html#geojson-objects).\n\n#### positionsOf\nreturns all the Positions in a valid [GeoJSON object](http://geojson.org/geojson-spec.html#geojson-objects)\n\n#### featuresOf\nreturns all the Features in a valid [GeoJSON object](http://geojson.org/geojson-spec.html#geojson-objects)\n\n#### geometriesOf\nreturns all the Geometries in a valid [GeoJSON object](http://geojson.org/geojson-spec.html#geojson-objects)\n","_attachments":{},"homepage":"https://github.com/dmtucker/gjtk-js","bugs":{"url":"https://github.com/dmtucker/gjtk-js/issues"},"license":"GPL"}