[Tile-serving] [openstreetmap/osm2pgsql] Import of changes failing because of TopologyException (#787)
Jesse Crocker
notifications at github.com
Thu Oct 5 18:58:32 UTC 2017
Thanks for the fix.
the delete statement found 4 invalid polygons.
```
osm_rendering=> DELETE FROM planet_osm_polygon WHERE NOT st_isvalid(way);
NOTICE: Self-intersection at or near point 19410477.129600767 -20061906.389537029
NOTICE: Self-intersection at or near point 587312.91697521065 6271092.4226212045
NOTICE: Self-intersection at or near point 587312.94425467972 6271092.4616400991
NOTICE: Self-intersection at or near point 11985875.570417937 4115611.1799857486
DELETE 4
```
I had to make a couple changes to the function/trigger to get it to work.
```
CREATE OR REPLACE FUNCTION planet_osm_polygon_osm2pgsql_valid()
RETURNS TRIGGER AS $$
BEGIN
IF ST_IsValid(NEW.way) THEN
RETURN NEW;
END IF;
RETURN NULL;
END
$$ LANGUAGE plpgsql;
CREATE TRIGGER planet_osm_polygon_osm2pgsql_valid BEFORE INSERT OR UPDATE
ON planet_osm_polygon
FOR EACH ROW EXECUTE PROCEDURE planet_osm_polygon_osm2pgsql_valid();
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/issues/787#issuecomment-334560128
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20171005/6ee8b02a/attachment.html>
More information about the Tile-serving
mailing list