I have a geojson file that is not displaying correctly, and I believe it has to do with the file containing multipolygons not following the right-hand rule. What tool can to help me fix this problem?

I've tried importing and exporting with QGIS, and converting back and forth between formats with org2org, but that didn't take me anywhere.

  • 1
    QGIS has Vector, Geometry Tools, Check validity. Ogr2ogr has ST_MakeValid with the -dialect Sqlite option to fix incorrect ring ordering.
    – klewis
    Dec 28, 2016 at 16:01
  • It's simple enough to implement the trapezoid rule in Java, JavaScript, or Python to calculate area and use sign to determine ring directionality. If you provided an example of the offending geometry and/or a graphic of the incorrect display we would have an easier time helping you.
    – Vince
    Dec 29, 2016 at 0:32

2 Answers 2


I believe https://github.com/mapbox/geojson-rewind will remedy your issue.

The GeoJSON specification is picky about winding order, it helps you generate compliant Polygon and MultiPolygon geometries, and it lets you use Canvas and other drawing libraries's default behavior to color the interior rings of Polygon and MultiPolygon features.


Not a tool, but you can read it with shapely and use shapely.geometry.polygon.orient to orient polygons (the default is already correct). With a few more lines of code you can also orient MultiPolygon by iterating over the included polygons.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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