[postgis-users] PostGIS Topology Error

Cameron Green u15055452 at tuks.co.za
Wed Jul 4 08:51:26 PDT 2018


Hi,

Thank you so much for the help. 

I have tried to view and clean the data in QGIS but the file size is too large, the file size is 25GB which makes it difficult to view. 

Currently, I am only looking for a tool to only identify all the errors, once I have identified the errors, then my next step will be to fix them. 

Kind regards,  
Cameron Green
President - CGIS YouthMappers
BSc(Hons) Geoinformatics, University of Pretoria
+2783 301 3201
+2712 420 2016

From: Nicolas Ribot
Sent: Wednesday, 04 July 2018 2:56 PM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] PostGIS Topology Error

Hi,
Indeed, Postgis Topology works well to build topo from clean geometries, but can fail if input geometries have topological errors.

It could be tricky to clean data with just postGIS and sql queries.
Topological GIS, like GRASS, can load PostGIS data and clean them at a given precision

HTH
Nicolas

On 4 July 2018 at 14:01, Cameron Green <u15055452 at tuks.co.za> wrote:
Good day,
 
My name is Cameron Green and I am an honours (4th year) student at the University of Pretoria in South Africa. I am currently working on a project that requires me to assess the quality of data that was downloaded from OpenStreetMap (OSM), specifically, various topological errors. I have decided to use PostGIS as it does error checks and tells me what the error is and where (or at least that is how I understand it). 
 
Firstly, here is my installation information (Ubuntu 16.04) with PostgreSQL 10:
POSTGIS="2.4.4 r16526" PGSQL="100" GEOS="3.5.0-CAPI-1.9.0 r4084" SFCGAL="1.2.2" PROJ="Rel. 4.9.2, 08 September 2015" GDAL="GDAL 1.11.3, released 2015/09/16" LIBXML="2.9.3" LIBJSON="0.11.99" LIBPROTOBUF="1.2.1" TOPOLOGY RASTER
 
Using the textbook, Mastering PostGIS chapter 8, where it deals with PostGIS Topology. Below is the SQL commands I used. When I used SRID as 4026 and 0,00028 as the snap threshold, the commands execute without any issues. However, when I change the SRID to 2049 and decrease the snap tolerance in the topology.toTopoGeom, I get the following error: 
 
ERROR: SQL/MM Spatial exception - geometry crosses edge 4469 CONTEXT: PL/pgSQL function totopogeom(geometry,topogeometry,double precision) line 114 at FOR over SELECT rows PL/pgSQL function totopogeom(geometry,character varying,integer,double precision) line 89 at assignment SQL state: XX000
 
The line and type of error changes as I increase the snap tolerance to any value between 5m and 100m.
 
>From my understanding, once the topology is created and the geometries are loaded into the topology, I should be able to run the topology.ValidateTopology function to get a list of errors. Is this correct? 
 
At the moment it seems like the topology errors is what preventing me from creating the topology. 
 
If anyone could please help me or direct me to where I have made an error in my SQL commands or there are some settings I must change. Any help regarding this would be greatly appreciated.  I have added the commands at the end of this email. 
 
Kind regards,
Cameron Green
President - CGIS YouthMappers
BSc(Hons) Geoinformatics, University of Pretoria
+2783 301 3201
+2712 420 2016
 
 
 
SQL Commands:  
topology.CreateTopology ('my_topology', 2049, 5, false) 
 
// Checked the validity of the input geometries 
select ST_IsValidReason(way) 
from osm_lines
where ST_IsValid(way) = false
 
// Create the TopoGeometry column 
select topology.AddTopoGeometryColumn('my_topology', 'public', osm_lines, 'topogeom', 'Linestring')
 
//  Populate the Topogeometry column from an existing geometry. 
// This is where my problem starts
update osm_lines SET topogeom = topology.toTopoGeom(way,'my_topology',1,5) 
 
select topology.TopologySummary('my_topology')
 
select * from  topology.ValidateTopology('my_topology')
 

This message and attachments are subject to a disclaimer. Please refer to http://www.it.up.ac.za/documentation/governance/disclaimer/ for full details.
_______________________________________________
postgis-users mailing list
postgis-users at lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/postgis-users



-- 
This message and attachments are subject to a disclaimer. Please refer to 

http://www.it.up.ac.za/documentation/governance/disclaimer/ 
<http://www.it.up.ac.za/documentation/governance/disclaimer/> for full 
details.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20180704/2dcdec62/attachment.html>


More information about the postgis-users mailing list