{"id":13554565,"url":"https://github.com/mapbox/geojsonhint","last_synced_at":"2025-04-03T07:31:46.864Z","repository":{"id":46656675,"uuid":"11635008","full_name":"mapbox/geojsonhint","owner":"mapbox","description":"IMPORTANT: This repo will be archived. Use @placemarkio/check-geojson instead","archived":true,"fork":false,"pushed_at":"2024-05-28T13:50:42.000Z","size":461,"stargazers_count":258,"open_issues_count":11,"forks_count":37,"subscribers_count":126,"default_branch":"master","last_synced_at":"2024-11-27T17:51:41.267Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mapbox.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-07-24T13:08:38.000Z","updated_at":"2024-07-25T16:47:56.000Z","dependencies_parsed_at":"2023-02-19T20:15:40.087Z","dependency_job_id":"93b492d4-bd71-4a7d-a59f-59ffefd40fdd","html_url":"https://github.com/mapbox/geojsonhint","commit_stats":{"total_commits":169,"total_committers":23,"mean_commits":"7.3478260869565215","dds":"0.34911242603550297","last_synced_commit":"da13f2ce8fde7bc03bb9e8f64753709e48588f5b"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fgeojsonhint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fgeojsonhint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fgeojsonhint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fgeojsonhint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mapbox","download_url":"https://codeload.github.com/mapbox/geojsonhint/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246956533,"owners_count":20860453,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T12:02:50.526Z","updated_at":"2025-04-03T07:31:46.551Z","avatar_url":"https://github.com/mapbox.png","language":"JavaScript","readme":"\n## This repo has been archived. You can use @placemarkio/check-geojson instead. \n\n\n\n[![Build Status](https://secure.travis-ci.org/mapbox/geojsonhint.svg?branch=master)](http://travis-ci.org/mapbox/geojsonhint) [![Coverage Status](https://coveralls.io/repos/mapbox/geojsonhint/badge.svg)](https://coveralls.io/r/mapbox/geojsonhint)\n\n# geojsonhint: complete, fast, standards-based validation for geojson\n\nImportant: development of geojsonhint is currently paused. Until development restarts, please refrain from adding non-critical issues or PRs.\n\nA [lint](https://en.wikipedia.org/wiki/Lint_%28software%29) tool for the [GeoJSON](https://tools.ietf.org/html/rfc7946)\nstandard. geojsonhint is written _to the standard_, with no missing or additional\nopinions about structure.\n\nThanks to `jsonlint-lines`, GeoJSON that is also not valid [JSON](http://json.org/)\ncan return informative, line-oriented parsing errors.\n\n## Specification\n\nThe basis of this tool is the published [GeoJSON](https://tools.ietf.org/html/rfc7946) specification.\n\n## API\n\n`errors = geojsonhint.hint(string or object, options)`\n\nLint a file, given as a string or object. This call detects all aberrations from\nthe GeoJSON standards and returns them as an array of errors. An example of the output:\n\n```json\n[{\n  \"message\": \"\\\"features\\\" property should be an array, but is an object instead\",\n  \"line\": 1\n}]\n```\n\nThe options argument is optional. It has these options:\n\n`noDuplicateMembers`.\n\nBy default, geojsonhint will treat repeated properties as an error: you can\nset noDuplicateMembers to false to allow them. For instance:\n\n```js\ngeojsonhint.hint('{\"type\":\"invalid\",\"type\":\"Feature\",\"properties\":{},\"geometry\":null}', {\n    noDuplicateMembers: false\n});\n```\n\nThe repeated `type` property in this input will be ignored with the option,\nand flagged without it.\n\n\n`precisionWarning`.\n\nGeoJSON [now recommends six decimal places of accuracy](https://tools.ietf.org/html/rfc7946#section-11.2)\nfor coordinates (Section 11.2). This option adds a warning message when coordinates\ncontain over 6 decimal places of accuracy, up to 10 coordinates before the warning\nmessage is truncated for performance.\n\n```js\ngeojsonhint.hint('{ \"type\": \"Point\", \"coordinates\": [100.0000000001, 5.0000000001] }', {\n    precisionWarning: false\n});\n```\n\nWith this option enabled, geojsonhint will produce these warnings:\n\n```js\n[{\n  line: 1,\n  level: 'message',\n  message: 'precision of coordinates should be reduced'\n}, {\n  line: 1,\n  level: 'message',\n  message: 'precision of coordinates should be reduced'\n}]\n```\n\nWithout this option, this input will pass without errors.\n\n`ignoreRightHandRule`.\n\nGeoJSON specification defined that linear rings must follow right-hand rule, but also says that for backward compatibility reasons parsers should not rejects polygons wiht incorrect winding order. For that kind of situations geojsonhint has an option `ignoreRightHandRule` which is `false` by default. Setting this option to `true` will cause geojsonhint to skip right-hand rule validation.\n\n```js\ngeojsonhint.hint(geojsonWithIncorrectWindingOrder, {\n  ignoreRightHandRule: true\n});\n````\n\nwith this option enabled, geojsonhint will not validate winding order.\n\n## Line Numbers\n\nNote that the GeoJSON can be given as a **string or as an object**. Here's how\nto choose which input to use:\n\n* `string` inputs receive **line numbers for each error**. These make errors\n  easier to track down if the GeoJSON is hand-written.\n* `object` inputs don't have line numbers but are evaluated faster, by up to 10x.\n  GeoJSONHint is _very fast already_ so unless you have identified it as a\n  bottleneck in your application, don't [prematurely optimize](http://c2.com/cgi/wiki?PrematureOptimization) based\n  on this fact.\n\nIf you're really trying to save space and don't care about JSON validity errors -\nonly GeoJSON errors - you can `require('geojsonhint/lib/object')` to get a version\nof this library that bypasses jsonlint-lines and provides only the object\ninterface.\n\n## use it\n\n**npm** (node.js, browserify, webpack, etc)\n\n    npm install --save @mapbox/geojsonhint\n\n**CDN / script tag**\n\nHit this URL to resolve to the latest pinned version.\n\n    https://unpkg.com/@mapbox/geojsonhint@latest/geojsonhint.js\n\n## As a command-line utility\n\nInstall:\n\n    npm install -g @mapbox/geojsonhint\n\n```\n➟ geojsonhint\nUsage: geojsonhint FILE.geojson\n\nOptions:\n  --json  output json-formatted data for hints\n```\n\n```\n➟ geojsonhint test.geojson\nline 9, each element in a position must be a number\n```\n\n## Development\n\n* Tests: `npm test`\n* Building the browser version: `npm run build`\n\n## See Also\n\n* [grunt-geojsonhint](https://github.com/jieter/grunt-geojsonhint) does it as a Grunt task\n* [GeoJSON-Validation](https://github.com/craveprogramminginc/GeoJSON-Validation) is another node module for this.\n* [geojson-assert](https://github.com/calvinmetcalf/geojson-assert) does it in assertion tests\n* [geojsonlint](https://github.com/ropenscilabs/geojsonlint) does it in an R package\n","funding_links":[],"categories":["JavaScript","others"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapbox%2Fgeojsonhint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmapbox%2Fgeojsonhint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapbox%2Fgeojsonhint/lists"}