# Ring Self-intersection while loading shapefile

**URL:** <https://forum.cmascenter.org/t/ring-self-intersection-while-loading-shapefile/3391>\
**Category:** Spatial Allocator\
**Created:** [June 29, 2022, 4:58am UTC](https://forum.cmascenter.org/t/ring-self-intersection-while-loading-shapefile/3391 "2022-06-29T04:58:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ali.mousavi.nezhad90](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.cmascenter.org/ali.mousavi.nezhad90/32/1527_2.png) [@ali.mousavi.nezhad90](https://forum.cmascenter.org/u/ali.mousavi.nezhad90)\
**Post date:** [June 29, 2022, 4:58am UTC](https://forum.cmascenter.org/t/ring-self-intersection-while-loading-shapefile/3391/1 "2022-06-29T04:58:32Z")

</div>

Hi,

I’m trying to load shapefiles onto a database by using pg\_srgtool. The problem is that for some shapefiles there are lots of notices that say “Ring Self-intersection at or near point …”. I was wondering how I can fix this issue?  
Attached is the screenshot of the notice.

 ![pic](https://canada1.discourse-cdn.com/flex027/uploads/cmas/original/2X/8/8d0185bc6d3f724bc30af6e5f20b64d6f8aa5580.png)

---

<div class="post-metadata">

**Author:** ![eyth.alison](https://avatars.discourse-cdn.com/v4/letter/e/7ab992/32.png) [@eyth.alison](https://forum.cmascenter.org/u/eyth.alison)\
**Post date:** [July 5, 2022, 12:39pm UTC](https://forum.cmascenter.org/t/ring-self-intersection-while-loading-shapefile/3391/2 "2022-07-05T12:39:04Z")

</div>

We haven’t encountered this issue with that shapefile, although have seen it with some others. It is usually not an issue worth fixing: the surrogate tool will run through and you will get good results. There are ways to use GIS tools (Arc, QGIS, ogr/gdal, etc.) to attempt to correct these types of issues if you find that the results are not good – but this is probably in localized areas. The most common methods are st\_makevalid (in SQL) or applying a small negative buffer.

Are the desired surrogates being generated or is the software failing?

---

<div class="post-metadata">

**Author:** ![cseppan](https://avatars.discourse-cdn.com/v4/letter/c/6de8d8/32.png) [@cseppan](https://forum.cmascenter.org/u/cseppan)\
**Post date:** [July 5, 2022, 4:45pm UTC](https://forum.cmascenter.org/t/ring-self-intersection-while-loading-shapefile/3391/3 "2022-07-05T16:45:46Z")

</div>

When loading shapefiles, the SurrogateToolsDB scripts automatically call the PostGIS function [ST\_MakeValid](https://postgis.net/docs/ST_MakeValid.html) which checks and fixes geometry problems. This step causes the NOTICEs seen in the logs.
