DEV Community

Cover image for Solution: Polygons and MultiPolygons should follow the right-hand rule
vasubabu
vasubabu

Posted on

7 2

Solution: Polygons and MultiPolygons should follow the right-hand rule

I use OpenStreetMaps/Datahub.io to get the polygon data for an area.
For Country polygons, I prefer Datahub.io and others I prefer Open street maps.

Links:
https://nominatim.openstreetmap.org/search.php?q=liege&polygon_geojson=1&format=json
Note: Please change q=liege to your desired place and nominatim is the UI built on top of OSM.
Datahub.io

sometimes you may see the below error while validating a Geo-JSON data downloaded using https://geojsonlint.com

Line 1: Polygons and MultiPolygons should follow the right-hand rule

Alt Text

This is because the Geo-JSON data is not following the Right-Hand rule.

What is a Right-Hand rule?

When you construct a polygon, you can order the coordinates in one direction or another. If you’re drawing a circle, you might start on the left and go counter-clockwise around to meet the original point. Or, you might go clockwise.

Here is the specification:

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.

Source: mapster

Fix: Its very hard to convert the Geo-Json data according to Right hand rule, one way is use this tool to do that

http://mapster.me/right-hand-rule-geojson-fixer/

Alt Text

Geo-JSON Lint:
Alt Text

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more