The query could be rewritten to include the original id field, but it is no longer guaranteed to be unique. I include a generated id here, as ST_MakeValid will produce potentially more than one polygon from the input geometries. Where invalid_table is the table resulting from the original shp2pgsql import. Select id, geom from make_valid where ST_GeometryType(geom)='ST_Polygon' (ST_Dump(ST_MakeValid(geom))).geom as geom from invalid_table A further refinement, therefore, might be to check the geometry type returned and only include, for example, the polygons that result from ST_MakeValid. In practice, using either ST_MakeValid(geom) or ST_Buffer(geom, 0) might produce a mixture of geometry types, including orphaned points and linestrings. 3) Apply a Boolean modifier to the tori mesh. 2) Add a cube that encloses the tori mesh. If you look closely, all of the tori are in a single mesh, but not connected. This example was formed by adding a single torus, then using array modifier and applying the modifiers. There is also an associated function, ST_IsValidReason which will inform as to where the issue lies, rather than just blindly attempting to fix it. 1) Start with the mesh with all of the tori. 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.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |