http://geojsonlint.com/ I get error

 Polygons and MultiPolygons should follow the right-hand rule

I used it for past 3 years without any problem with my old geojson file. Now geojsonlint enforce the right hand rule, how to fix the problem.


As of August 2016 GeoJSON is now a formal IETF specification. And some things have changed from the old informal 2008 spec. So to be valid for the 2016 spec your polygons MUST be right-hand wound.

See https://tools.ietf.org/html/rfc7946#section-3.1.6

The use of MUST indicates an absolute requirement of the specification. However then the subsequent language about not rejecting other windings is weird and is open to some argument - perhaps parsers should accept and correct other windings. I think this what lead geojsonlint (from geojsonhint) to use the word should instead of MUST in their feedback message.

So I agree with the position of geojsonlint.com as they place right at the top of their page the link to the 2016 spec. Your polygons are bad per the 2016 spec. But yet they are fine per the informal 2008 spec. So if you do not wish to change the winding of your polygons, you will need to make certain any linters or parsers you use honor the old 2008 spec and do not one day suddenly migrate to the new formal spec.

Or perhaps you should consider changing your polygon winding as doing so will get you in line with both specs and better positioned for the future as the 2008 spec fades away.

Note that for me the largest change in the 2016 spec was the dropping utterly of the support for coordinate systems. I had all my GeoJSON in NAD83 and then had to quietly remove that as now all GeoJSON is WGS84. Fortunately for me coming from Oracle Spatial all my polygons were already right-hand wound.

| improve this answer | |
  • For me it would be good if geojsonlint had on option to skip the winding test, or report that as a separate issue. That is what the specification is somehow recommending as well. – user30184 Oct 28 '17 at 12:59

The Right Hand Rule GeoJSON Fixer | Mapster page has a client-side JavaScript function that fixes the right hand rule problem.

| improve this answer | |
  • This service isn't working anymore, in FF or Chrome – Henrik Mar 19 '19 at 18:49
  • @Henrik : I've just used it working correctly in FF.70. Maybe it's back. – allez l'OM Dec 3 '19 at 12:02

my old geojson work with google map, leaflet, openlayer, mapbox, bing map, etc. however failed geojsonlint.com validate.

I have to use another website to validate: http://geojson.io

| improve this answer | |

For anyone finding this and looking for a tool to fix them. GDALs ogr2ogr can take "2008" spec GeoJSON and write out in "RFC7946" standard mode (with polygons following the right-hand rule for orientation).

ogr2ogr -f GeoJSON -lco RFC7946=YES output.json input.json

or for use in scripts where you want to input and output the GeoJSON as a string:

echo 'Your GeoJSON' | ogr2ogr -f GeoJSON -lco RFC7946=YES /vsistdout/ /vsistdin/

| improve this answer | |

This can be fixed very easily in Python using geojson-rewind.

from geojson_rewind import rewind

rewoundGeoJSON = rewind(geoJSONString)
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.