The right-hand rule error for geojson

By using on of many geojson tester on line, like or (this is especially cool cause you can see the geometry in a map) you can receive this message “Invalid GeoJSON Line 51: Polygons and MultiPolygons should follow the right-hand rule”.

To avoid this error put counterclockwise the list of points of external boundary: by hand, by code (like Python geojson-rewind) o by webpage mapster-right-hand-rule-fixer.

So what’s right-hand rule?

This rule state that in a valid geojson Polygon at least 4 points have to delimit a surface (they are 4 because the simplest shape is a triangle, and the first and the last points are identical) and they have to be sorted counterclockwise.


This rules come from the standard of geojson (

In the standard a LineStrings is the name used for a linear ring, that’s a closed curve that represents the boundary of a surface or the boundary of a
hole in a surface

At paragraph 3.1.6. the standard states that, for a Polygon,  a LineStrings “MUST follow the right-hand rule with respect to the area it bounds, i.e., exterior rings are counterclockwise, and holes are clockwise.”

A visual explanation is here:


So, next time you face the right-hand rule error remember the you have to rewind (sort countuterclockwise) the external boundary. And also that, instade of boundary you can find the word ring.

An finally: that this rule is needed to avoid errors in the surface computation.




Leave a Reply

Your email address will not be published.