Postgresql Snap İşlemi İle Hat Bölme

Hatları belirli bir noktadan veya başka bir obje ile bölmek için aşağıdaki kod yapısı kullanılabilir.

(Select ST_AsText(ST_GeometryN(ST_Split(x.s_geom,ST_Snap(x.a_geom,x.s_geom,0)),1)) as line_1,
 	ST_AsText(ST_GeometryN(ST_Split(x.s_geom,ST_Snap(x.a_geom,x.s_geom,0)),2)) as line_2,
 	ST_AsText(ST_Snap(x.a_geom,x.s_geom,0)) as snap_geom,
 	ST_AsText(ST_Split(x.s_geom,ST_Snap(x.a_geom,x.s_geom,0))) as cut_Wkt,
 ST_AsText(x.a_geom) as a_geom_wkt
	from (Select (Select s."SP_GEOMETRY" as s_geom from gis_net_geo_cln_line s where s.line_Code=579),
(Select a."SP_GEOMETRY" as a_geom from gis_net_geo_cln_line a where a.line_Code=3369)) as x)

 

Bu örnek sorguda aşağıdaki pembe renkli abone hattı ile şebeke hattı hatta snap yapılarak bölünebilmektedir.

 

Sorgu çalıştırıldığında aşağıdaki gibi bir output vermektedir.

Oluşan geometry lere baktığımızda ise aşağıdaki ekran görüntüsündeki gibi bir sonuç elde etmiş oluyoruz.

Add comment

Loading