How can we fix ring self-intersections in ArcGIS?

How can we fix ring self-intersections in ArcGIS?

We’re importing a whole bunch of ArcGIS shapefiles into PostGIS, converted on the fly with shp2pgsql. Problem is, if the shapefiles have any ring self-intersections, the import chokes: How can we fix this?

How to automatically fix ring self-intersections in Java?

In practice, using either ST_MakeValid (geom) or ST_Buffer (geom, 0) might produce a mixture of geometry types, including orphaned points and linestrings. A further refinement, therefore, might be to check the geometry type returned and only include, for example, the polygons that result from ST_MakeValid.

How to fix self intersecting polygons in shp?

While buffering a feature by zero is a known fix for self-intersecting polygons — which are all too common in shp files — as suggested by Marcelo, there is also the ST_MakeValid function for this purpose.

Which is the basis for the PostGIS geographic type?

The basis for the PostGIS geographic type is a sphere. The shortest path between two points on the sphere is a great circle arc. That means that calculations on geographies (areas, distances, lengths, intersections, etc) must be calculated on the sphere, using more complicated mathematics.

What are the rules for polygons in PostGIS?

Rings may not self-intersect (they may neither touch nor cross one another). Rings may not touch other rings, except at a point. The last two rules are in the arbitrary category. There are other ways to define polygons that are equally self-consistent but the rules above are the ones used by the OGC SFSQL standard that PostGIS conforms to.

How to fix polygon self-intersection in QGIS?

When I get errors like this I usually find applying a zero distance buffer can fix the geometries. So use the buffer tool in QGIS and set the buffer distance to 0 units. Then try and use this buffered layer as the mask.