PHPackages                             vicchi/geojson-rewind - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. vicchi/geojson-rewind

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

vicchi/geojson-rewind
=====================

PHP helper classes to enforce RFC7946 polygon winding order in GeoJSON

1.0.1(2y ago)92.3k10BSD-3-ClausePHPPHP ^7.1|^8.0

Since Feb 9Pushed 2y agoCompare

[ Source](https://github.com/vicchi/geojson-rewind)[ Packagist](https://packagist.org/packages/vicchi/geojson-rewind)[ RSS](/packages/vicchi-geojson-rewind/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (4)Used By (0)

[![Build Status](https://camo.githubusercontent.com/88cef65ccc0eceb0c16a0c32ff951ab96957a8bf596f7f6df0c866c2c1d2fec6/68747470733a2f2f7472617669732d63692e6f72672f7669636368692f67656f6a736f6e2d726577696e642e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/vicchi/geojson-rewind)

geojson-rewind
==============

[](#geojson-rewind)

A set of PHP helper classes to assist in generating GeoJSON geometries that are compliant with the [GeoJSON specification](https://tools.ietf.org/html/rfc7946).

Polygon 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.

> 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.

(If you know British English rather than American English, simply substitute *anticlockwise* for *counterclockwise*.)

Acknowledgements
----------------

[](#acknowledgements)

`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.

Install
-------

[](#install)

The easiest way to install `geojson-rewind` is by using [composer](https://getcomposer.org/):

```
$> composer require vicchi/geojson-rewind

```

Usage
-----

[](#usage)

```

```

The output could look like this (`$>` is the command line prompt).

```
$> php test.php
array(2) {
  ["type"]=>
  string(7) "Polygon"
  ["coordinates"]=>
  array(2) {
    [0]=>
    array(5) {
      [0]=>
      array(2) {
        [0]=>
        float(100)
        [1]=>
        float(0)
      }
      [1]=>
      array(2) {
        [0]=>
        float(101)
        [1]=>
        float(0)
      }
      [2]=>
      array(2) {
        [0]=>
        float(101)
        [1]=>
        float(1)
      }
      [3]=>
      array(2) {
        [0]=>
        float(100)
        [1]=>
        float(1)
      }
      [4]=>
      array(2) {
        [0]=>
        float(100)
        [1]=>
        float(0)
      }
    }
    [1]=>
    array(5) {
      [0]=>
      array(2) {
        [0]=>
        float(100.2)
        [1]=>
        float(0.2)
      }
      [1]=>
      array(2) {
        [0]=>
        float(100.2)
        [1]=>
        float(0.8)
      }
      [2]=>
      array(2) {
        [0]=>
        float(100.8)
        [1]=>
        float(0.8)
      }
      [3]=>
      array(2) {
        [0]=>
        float(100.8)
        [1]=>
        float(0.2)
      }
      [4]=>
      array(2) {
        [0]=>
        float(100.2)
        [1]=>
        float(0.2)
      }
    }
  }
}

```

License
-------

[](#license)

`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.

###  Health Score

36

↓

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2273 days

Total

2

Last Release

738d ago

PHP version history (2 changes)v1.0.0PHP ^7.1

1.0.1PHP ^7.1|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/63a7573017ab07c8bc4d34283fbdbe30016fb2d0e8a2d04df32e55533716c915?d=identicon)[vicchi](/maintainers/vicchi)

---

Top Contributors

[![vicchi](https://avatars.githubusercontent.com/u/442617?v=4)](https://github.com/vicchi "vicchi (8 commits)")

---

Tags

geojsonphpphp-libraryphp7phpPolygongeojsonwinding order

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/vicchi-geojson-rewind/health.svg)

```
[![Health](https://phpackages.com/badges/vicchi-geojson-rewind/health.svg)](https://phpackages.com/packages/vicchi-geojson-rewind)
```

###  Alternatives

[funiq/geophp

Open-source native PHP library for doing geometry operations. Can read and write a wide variety of formats: (E)WKT, (E)WKB, TWKB, GeoJSON, KML, GPX, GeoRSS. Works with all Simple-Feature geometries (Point, LineString, Polygon...) and can be used to get centroids, bounding-boxes, area, etc.

21114.4k1](/packages/funiq-geophp)[imanghafoori/laravel-anypass

A minimal yet powerful package to help you in development.

21421.6k](/packages/imanghafoori-laravel-anypass)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
