{"id":13856701,"url":"https://github.com/yazeed44/gjf","last_synced_at":"2025-09-07T18:32:51.428Z","repository":{"id":57434876,"uuid":"378593107","full_name":"yazeed44/gjf","owner":"yazeed44","description":"A tool in Python to fix invalid GeoJSON objects and files","archived":false,"fork":false,"pushed_at":"2021-06-22T10:47:59.000Z","size":16,"stargazers_count":102,"open_issues_count":2,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-01T10:12:30.193Z","etag":null,"topics":["command-line-tool","fix","geojson","python","validation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yazeed44.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}},"created_at":"2021-06-20T08:14:42.000Z","updated_at":"2024-08-13T21:42:56.000Z","dependencies_parsed_at":"2022-09-04T15:32:33.639Z","dependency_job_id":null,"html_url":"https://github.com/yazeed44/gjf","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yazeed44%2Fgjf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yazeed44%2Fgjf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yazeed44%2Fgjf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yazeed44%2Fgjf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yazeed44","download_url":"https://codeload.github.com/yazeed44/gjf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232137185,"owners_count":18477785,"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":["command-line-tool","fix","geojson","python","validation"],"created_at":"2024-08-05T03:01:09.576Z","updated_at":"2025-01-02T19:28:33.290Z","avatar_url":"https://github.com/yazeed44.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# gjf: A tool for fixing invalid GeoJSON objects\n\nThe goal of this tool is to make it as easy as possible to fix invalid GeoJSON objects through Python or Command Line.\n## Installation\n```shell\npip install gjf\n```\nVerify installation by running  \n```shell\ngjf --version\n```\n### Features\n- Fix all types of GeoJSON objects, including FeatureCollection and Geometry Collection. If there is nothing to fix the object will be returned as is. \n- Can validate GeoJSON objects, and print explanations if the object is not valid.\n- Can be used within Python or command line\n## Usage\n### Python\nSay, you have a GeoJSON object defined as follows:\n```python\nobj = {\"type\":\"Polygon\",\"coordinates\":[[[45.892166,25.697688],[45.894522,25.696483],[45.897131,25.695144],[45.898814,25.694268],[45.900496,25.693394],[45.901284,25.692983],[45.903946,25.697312],[45.894791,25.701933],[45.894621,25.701657],[45.892593,25.698379],[45.892166,25.697688]],[[45.892086,25.697729],[45.892166,25.697688],[45.892086,25.697729]]]}\n```\nYou can simply call `apply_fixes_if_needed`\n```python\nfrom gjf.geojson_fixer import apply_fixes_if_needed\n\nfixed_obj = apply_fixes_if_needed(obj)\n```\nYou can also flip coordinates order by toggling `flip_coords`\n```python\nfrom gjf.geojson_fixer import apply_fixes_if_needed\n\nfixed_obj_with_flipped_coordinates = apply_fixes_if_needed(obj, flip_coords=True)\n```\n\nYou can also check whether a GeoJSON object is valid or not by calling `validity`\n```python\nfrom gjf.geojson_fixer import validity\nvalidity(obj)\n```\nWill result `('invalid', ['Too few points in geometry component[45.892086 25.697729]', ''])`\n### CLI\n```shell\ngjf invalid.geojson\n```\n`gjf` will fix the file, and output to `invalid_fixed.geojson` by default. If you need the output directed in another way you can use `--output-method` as directed below. It is also possible to fix multiple files, as below.\n```shell\ngjf invalid_1.geojson invalid_2.geojson\n```\nAbove will output fixed GeoJSON objects to `invalid_1_fixed.geojson` and `invalid_2_fixed.geojson`. \n#### CLI Arguments\n- `--version` print version and exit\n- `--validate` validate GeoJSON file, and print the error message if it is not valid, without attempting to fix it.\n- `--flip` Flip coordinates order\n- `-o, --output-method [overwrite|new_file|print]`\n  - Default is `new_file`, where `gjf` will output fixed GeoJSON object to file with the postfix `_fixed`. Whereas `overwrite` will write the fixed GeoJSON object to the source file, overwriting the original file in process. Lastly, `print` will output the fixed GeoJSON object on the terminal\n  \n```shell\ngjf --output-method print invalid.geojson\n```\nThis would print fixed `invalid.geojson` on the terminal\n\n### Issues\nFeel free to open an issue if you have any problems.\n\n### Special Thanks\n- [Shapely](https://github.com/Toblerity/Shapely)\n- [geojson-rewind](https://github.com/chris48s/geojson-rewind)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyazeed44%2Fgjf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyazeed44%2Fgjf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyazeed44%2Fgjf/lists"}