简体   繁体   English

我如何删除postgis中的重叠行

[英]how do i remove overlapping lines in postgis

I have a typical database with millions of polygons as land parcels and i want to split these polygons onto lines and then remove the lines that overlap eachother. 我有一个典型的数据库,有数百万个多边形作为地块,我想将这些多边形分成线,然后去掉相互重叠的线。 These lines will be used purely for rendering in mapnik/and or geoserver as at the moment every parcel boundary gets rendered twice. 这些线将纯粹用于在mapnik /和geoserver中渲染,因为每个宗地边界都会被渲染两次。

i propose to split the parcel polygons into a new table ("boundary_lines") and then search and remove overlapping lines. 我建议将宗地多边形拆分为一个新表(“boundary_lines”),然后搜索并删除重叠的行。 how would i go about removing these overlapping lines in postgis? 我将如何在postgis中删除这些重叠的行?

Use ST_Equals: 使用ST_Equals:
http://postgis.refractions.net/docs/ST_Equals.html http://postgis.refractions.net/docs/ST_Equals.html

Your SQL statement will probably look something like this: 您的SQL语句可能如下所示:

SELECT y.id, z.id 
FROM mytable y, mytable z
WHERE ST_Equals(y.the_geom,z.the_geom)

The query will take forever to run, but hopefully you only have to do it once. 查询将永远运行,但希望您只需要执行一次。 After running it, take the results and carefully delete duplicate id's. 运行后,取结果并小心删除重复的ID。

Note that this won't get rid of boundaries that don't overlap exactly. 请注意,这不会摆脱不完全重叠的边界。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM