{"id":15296313,"url":"https://github.com/vicchi/geojson-rewind","last_synced_at":"2025-04-13T19:42:15.695Z","repository":{"id":57077761,"uuid":"120901435","full_name":"vicchi/geojson-rewind","owner":"vicchi","description":"Enforce polygon ring winding order for GeoJSON in PHP","archived":false,"fork":false,"pushed_at":"2024-05-02T11:07:07.000Z","size":20,"stargazers_count":9,"open_issues_count":0,"forks_count":10,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-27T10:21:29.114Z","etag":null,"topics":["geojson","php","php-library","php7"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vicchi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2018-02-09T12:11:18.000Z","updated_at":"2024-05-02T11:07:10.000Z","dependencies_parsed_at":"2024-10-15T01:21:45.435Z","dependency_job_id":"8d85d001-bfdc-4ea9-9f81-5834ffcf18f4","html_url":"https://github.com/vicchi/geojson-rewind","commit_stats":{"total_commits":6,"total_committers":1,"mean_commits":6.0,"dds":0.0,"last_synced_commit":"be2434c6b72587b8da957976824f39f0be8afe29"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vicchi%2Fgeojson-rewind","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vicchi%2Fgeojson-rewind/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vicchi%2Fgeojson-rewind/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vicchi%2Fgeojson-rewind/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vicchi","download_url":"https://codeload.github.com/vicchi/geojson-rewind/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248770991,"owners_count":21159071,"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":["geojson","php","php-library","php7"],"created_at":"2024-09-30T18:10:02.410Z","updated_at":"2025-04-13T19:42:15.671Z","avatar_url":"https://github.com/vicchi.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/vicchi/geojson-rewind.svg?branch=master)](https://travis-ci.org/vicchi/geojson-rewind)\n\n# geojson-rewind\n\nA set of PHP helper classes to assist in generating GeoJSON geometries that are\ncompliant with the [GeoJSON specification](https://tools.ietf.org/html/rfc7946).\n\nPolygon ring order was undefined in the original GeoJSON spec, but since RFC7946 the _[right hand rule](https://tools.ietf.org/html/rfc7946#section-3.1.6)_ is mandated.\n\n\u003e A linear ring MUST follow the right-hand rule with respect to the area it bounds, i.e., exterior rings are counterclockwise, and holes are clockwise.\n\n(If you know British English rather than American English, simply substitute _anticlockwise_ for _counterclockwise_.)\n\n## Acknowledgements\n\n`geojson-rewind` is a port to PHP of Mapbox's Node.JS [`geojson-rewind`](https://github.com/mapbox/geojson-rewind) module by [Tom McWright](https://github.com/tmcw) et al. Full credits, kudos and acknowledgements are due to Tom and the rest of the [Mapbox](https://www.mapbox.com/) team.\n\n## Install\nThe easiest way to install `geojson-rewind` is by using [composer](https://getcomposer.org/):\n\n```\n$\u003e composer require vicchi/geojson-rewind\n```\n\n## Usage\n\n```php\n\u003c?php\n\ninclude \"vendor/autoload.php\";\n\n$source = [\n    'type' =\u003e 'Polygon',\n    'coordinates' =\u003e [\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$enforce_rfc7946=true;\n$output = Vicchi\\GeoJson\\Rewind::rewind($source, $enforce_rfc7946);\n\n// show output for demonstration purposes\nvar_dump($output);\n\n?\u003e\n```\n\nThe output could look like this (`$\u003e` is the command line prompt).\n\n```\n$\u003e php test.php\narray(2) {\n  [\"type\"]=\u003e\n  string(7) \"Polygon\"\n  [\"coordinates\"]=\u003e\n  array(2) {\n    [0]=\u003e\n    array(5) {\n      [0]=\u003e\n      array(2) {\n        [0]=\u003e\n        float(100)\n        [1]=\u003e\n        float(0)\n      }\n      [1]=\u003e\n      array(2) {\n        [0]=\u003e\n        float(101)\n        [1]=\u003e\n        float(0)\n      }\n      [2]=\u003e\n      array(2) {\n        [0]=\u003e\n        float(101)\n        [1]=\u003e\n        float(1)\n      }\n      [3]=\u003e\n      array(2) {\n        [0]=\u003e\n        float(100)\n        [1]=\u003e\n        float(1)\n      }\n      [4]=\u003e\n      array(2) {\n        [0]=\u003e\n        float(100)\n        [1]=\u003e\n        float(0)\n      }\n    }\n    [1]=\u003e\n    array(5) {\n      [0]=\u003e\n      array(2) {\n        [0]=\u003e\n        float(100.2)\n        [1]=\u003e\n        float(0.2)\n      }\n      [1]=\u003e\n      array(2) {\n        [0]=\u003e\n        float(100.2)\n        [1]=\u003e\n        float(0.8)\n      }\n      [2]=\u003e\n      array(2) {\n        [0]=\u003e\n        float(100.8)\n        [1]=\u003e\n        float(0.8)\n      }\n      [3]=\u003e\n      array(2) {\n        [0]=\u003e\n        float(100.8)\n        [1]=\u003e\n        float(0.2)\n      }\n      [4]=\u003e\n      array(2) {\n        [0]=\u003e\n        float(100.2)\n        [1]=\u003e\n        float(0.2)\n      }\n    }\n  }\n}\n```\n\n## License\n\n`geojson-rewind` is published under the [BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause) license. See [License File](LICENSE.txt) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvicchi%2Fgeojson-rewind","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvicchi%2Fgeojson-rewind","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvicchi%2Fgeojson-rewind/lists"}