WITH segment_line AS
(

	SELECT 1 AS id, 'LINESTRING(22.88333 41.96667,24.876111 42.053361)'::geography AS line
	UNION
	SELECT 2 AS id, 'LINESTRING(22.88333 41.96667,21.32667 42.13667)'::geography AS line
	
)
, borders AS
(
	SELECT 'MULTIPOLYGON(((22.94472 41.34667,22.93667 41.34083,22.92778 41.34139,22.92722 41.33861,22.91417 41.34111,22.90528 41.34056,22.90472 41.33944,22.89861 41.33806,22.89083 41.33861,22.88778 41.34167,22.88556 41.34056,22.88028 41.34,22.87972 41.34083,22.87722 41.33972,22.87028 41.34111,22.86278 41.34056,22.85667 41.33778,22.85306 41.33944,22.84667 41.33722,22.83694 41.3375,22.82778 41.33472,22.82361 41.335,22.82222 41.33472,22.81833 41.33639,22.815 41.33944,22.81583 41.34083,22.81167 41.34389,22.80917 41.34222,22.81 41.33944,22.80889 41.33806,22.80639 41.33889,22.8025 41.33833,22.80056 41.33944,22.80028 41.34083,22.79889 41.34056,22.79639 41.3375,22.79722 41.33556,22.795 41.33389,22.79278 41.33056,22.79083 41.33,22.79111 41.32861,22.78889 41.32861,22.78806 41.32944,22.78528 41.32611,22.78 41.32778,22.77889 41.32694,22.77278 41.32583,22.76833 41.32639,22.76861 41.32528,22.76583 41.32389,22.76083 41.3175,22.76083 41.31556,22.75639 41.30639,22.75667 41.30528,22.75889 41.29722,22.76083 41.29722,22.76278 41.29611,22.76528 41.29361,22.76556 41.29222,22.765 41.29056,22.76278 41.28917,22.76222 41.28667,22.76306 41.28472,22.76194 41.28333,22.76 41.28278,22.76056 41.28083,22.75861 41.28028,22.75806 41.27778,22.75583 41.27611,22.75833 41.27333,22.75861 41.26972,22.76056 41.2675,22.75611 41.245,22.74833 41.1675,22.74528 41.16167,22.74139 41.15833,22.73556 41.15028,22.73083 41.14583,22.7275 41.14472,22.71611 41.14417,22.7125 41.14056,22.71028 41.14028,22.705 41.14444,22.70389 41.14667,22.70056 41.14944,22.69722 41.15417,22.68833 41.15889,22.68556 41.16472,22.68333 41.165,22.68111 41.16806,22.67667 41.17139,22.67611 41.1725,22.67667 41.17417,22.67306 41.17917,22.66806 41.18111,22.66639 41.18667,22.6625 41.18528,22.65639 41.18444,22.65528 41.18167,22.64944 41.18139,22.64778 41.18,22.64528 41.17667,22.64444 41.17222,22.64028 41.16889,22.6425 41.16528,22.6425 41.16083,22.63861 41.15583,22.63611 41.1525,22.62694 41.14472,22.61722 41.13361,22.61139 41.12944,22.59028 41.11778,22.57972 41.11806,22.57333 41.12,22.56444 41.12694,22.56222 41.13083,22.56139 41.13111,22.535 41.13028,22.50667 41.12667,22.50417 41.12528,22.49 41.12167,22.48889 41.12194,22.48389 41.11944,22.48028 41.12056,22.47028 41.12,22.46667 41.1175,22.46417 41.11694,22.46306 41.11833,22.4575 41.12111,22.45333 41.12056,22.45028 41.12194,22.44944 41.12056,22.44528 41.11917,22.44472 41.11833,22.44056 41.12,22.43278 41.11889,22.43056 41.12167,22.42556 41.12,22.41806 41.11917,22.41444 41.12056,22.41417 41.12222,22.41111 41.125,22.40167 41.12917,22.40222 41.13361,22.40556 41.13611,22.405 41.13667,22.39806 41.13806,22.39472 41.1375,22.39222 41.13639,22.38917 41.13222,22.38417 41.13333,22.3825 41.13278,22.38 41.13333,22.37972 41.13444,22.37556 41.13611,22.37389 41.13778,22.36833 41.13778,22.36444 41.13306,22.36278 41.1325,22.35889 41.13417,22.35194 41.13556,22.34889 41.13528,22.34806 41.13472,22.34861 41.13417,22.34806 41.13333,22.34444 41.13333,22.34417 41.13111,22.34278 41.13,22.34 41.13111,22.33556 41.12833,22.33333 41.12861,22.3325 41.12694,22.33333 41.12667,22.33444 41.12139,22.33389 41.12056,22.3275 41.12139,22.32528 41.12806,22.3275 41.1325,22.32611 41.13389,22.32583 41.13778,22.32444 41.14056,22.3225 41.14167,22.32083 41.14417,22.32083 41.14722,22.32389 41.15139,22.31639 41.14944,22.31444 41.1475,22.31139 41.14667,22.30583 41.14583,22.3 41.14972,22.28417 41.15472,22.27806 41.15389,22.27417 41.15583,22.27306 41.15806,22.27278 41.16222,22.26833 41.16417,22.26278 41.16417,22.26056 41.16611,22.24944 41.16583,22.24806 41.16417,22.24611 41.16611,22.245 41.16611,22.23944 41.16333,22.23722 41.16306,22.23333 41.165,22.225 41.16444,22.21917 41.16722,22.21611 41.17,22.20833 41.16667,22.20583 41.16333,22.20583 41.16139,22.19278 41.16222,22.1725 41.1575,22.17028 41.15583,22.16944 41.15278,22.16722 41.15056,22.16611 41.15056,22.16444 41.14833,22.16306 41.14306,22.15361 41.13778,22.15278 41.13389,22.14861 41.12778,22.13944 41.125,22.13611 41.125,22.13278 41.12611,22.12944 41.12333,22.12028 41.12667,22.11472 41.13278,22.11056 41.13472,22.10194 41.13667,22.09694 41.13889,22.09361 41.13694,22.09111 41.13833,22.08806 41.13833,22.085 41.14111,22.08444 41.14278,22.07833 41.145,22.07889 41.14667,22.08139 41.14861,22.07917 41.1525,22.07472 41.15639,22.07167 41.15583,22.0675 41.15667,22.065 41.16,22.06194 41.16111,22.06139 41.16028,22.06167 41.15417,22.06056 41.15167,22.05833 41.14972,22.05278 41.14778,22.04639 41.14806,22.04667 41.14556,22.04306 41.14417,22.04167 41.14028,22.03333 41.13806,22.03083 41.13556,22.03028 41.13361,22.02722 41.13278,22.01806 41.13278,22.00694 41.13083,22.005 41.13,22.00333 41.12806,21.99417 41.1275,21.99139 41.12583,21.98694 41.12861,21.97806 41.1275,21.97611 41.13,21.97389 41.12972,21.97139 41.12778,21.96861 41.12278,21.96444 41.12111,21.96167 41.1175,21.95722 41.11667,21.95389 41.11694,21.95306 41.11611,21.95222 41.11194,21.95083 41.11056,21.94639 41.11083,21.93444 41.10556,21.93111 41.10389,21.92944 41.10028,21.92194 41.09528,21.91861 41.09389,21.91139 41.09278,21.90944 41.09167,21.91167 41.08639,21.91139 41.085,21.90917 41.08444,21.91028 41.08333,21.91 41.08167,21.90722 41.07778,21.90611 41.07222,21.90389 41.06944,21.90861 41.065,21.90972 41.05889,21.90917 41.05667,21.91083 41.05333,21.91361 41.05028,21.91222 41.05028,21.90917 41.04611,21.90722 41.04556,21.9025 41.04167,21.90111 41.04111,21.9 41.04194,21.89778 41.03917,21.88167 41.04083,21.88194 41.03667,21.88417 41.02917,21.88389 41.0275,21.87972 41.02778,21.87333 41.02583,21.87417 41.02306,21.87361 41.02222,21.87028 41.02139,21.86667 41.02194,21.8625 41.01944,21.85972 41.01944,21.85944 41.01667,21.85361 41.01389,21.8475 41.00639,21.84917 41.00333,21.84806 40.99917,21.84389 40.99528,21.8325 40.99361,21.82583 40.98861,21.8225 40.98861,21.81583 40.98639,21.81333 40.98472,21.81056 40.98139,21.80667 40.98056,21.80028 40.97472,21.80111 40.97028,21.80056 40.95861,21.8025 40.95694,21.80528 40.95222,21.805 40.95083,21.8025 40.94806,21.80389 40.945,21.80028 40.94194,21.79694 40.94139,21.79083 40.9375,21.78917 40.93583,21.78944 40.93361,21.78861 40.93167,21.78194 40.92889,21.77639 40.92972,21.77028 40.92833,21.765 40.92889,21.76056 40.92639,21.75667 40.92528,21.75306 40.92583,21.75306 40.92722,21.74694 40.93111,21.73639 40.93222,21.73417 40.93111,21.73056 40.93083,21.72806 40.93333,21.72194 40.93722,21.71194 40.94083,21.71 40.94056,21.70778 40.94306,21.705 40.94444,21.70222 40.94389,21.69917 40.94167,21.69417 40.94222,21.69167 40.94139,21.68972 40.94111,21.68778 40.94222,21.68333 40.94056,21.68139 40.93389,21.67806 40.93278,21.66889 40.92417,21.66611 40.91722,21.66639 40.91583,21.67 40.91333,21.66889 40.91028,21.67167 40.90722,21.67222 40.90222,21.67111 40.89944,21.66889 40.89889,21.66667 40.9,21.66111 40.89917,21.65139 40.90167,21.64694 40.90139,21.64194 40.89806,21.63861 40.89861,21.63778 40.8975,21.63361 40.89611,21.63222 40.89056,21.63083 40.88917,21.62778 40.88806,21.62472 40.88889,21.61972 40.88833,21.6175 40.88694,21.61056 40.87972,21.60917 40.87917,21.60694 40.88056,21.60528 40.88056,21.60278 40.87917,21.60167 40.87694,21.59972 40.87389,21.59917 40.87139,21.59306 40.86639,21.58861 40.86889,21.585 40.86944,21.575 40.86722,21.57361 40.86611,21.56778 40.86667,21.56667 40.86806,21.56667 40.87056,21.565 40.87583,21.5525 40.88111,21.54944 40.88417,21.5475 40.88889,21.5425 40.89194,21.53361 40.90139,21.53222 40.90611,21.52611 40.90861,21.525 40.91,21.5175 40.90806,21.49 40.91222,21.46472 40.90694,21.44 40.91722,21.41722 40.91806,21.38694 40.89694,21.36583 40.88278,21.36167 40.87917,21.35111 40.87722,21.34556 40.87444,21.33167 40.87111,21.32472 40.87028,21.32056 40.87083,21.31722 40.86972,21.31556 40.8675,21.30556 40.86694,21.30222 40.86583,21.28944 40.86556,21.28056 40.86389,21.27167 40.86556,21.26 40.86,21.25056 40.86306,21.25 40.86667,21.24722 40.86944,21.24583 40.8725,21.24278 40.87444,21.23056 40.87833,21.2225 40.87917,21.22 40.88111,21.21306 40.88389,21.20417 40.88417,21.19472 40.8775,21.19028 40.8775,21.17639 40.87528,21.17472 40.8725,21.17056 40.87056,21.16972 40.86778,21.16667 40.86556,21.16056 40.86333,21.15694 40.85833,21.15194 40.85722,21.1475 40.85722,21.14361 40.85556,21.13639 40.855,21.12972 40.85611,21.12139 40.85417,20.98056 40.85528,20.97722 40.88611,20.97722 40.89167,20.97944 40.89722,20.97806 40.89917,20.97056 40.90444,20.96806 40.91028,20.965 40.91139,20.96056 40.91111,20.95694 40.91556,20.94639 40.92278,20.9425 40.92222,20.94 40.92417,20.93667 40.92444,20.92806 40.92083,20.92444 40.92083,20.91583 40.92333,20.9125 40.92056,20.91167 40.91583,20.89611 40.91861,20.89139 40.92306,20.88333 40.925,20.84722 40.93722,20.83694 40.92694,20.83 40.91694,20.8275 40.91306,20.8275 40.90694,20.82639 40.90528,20.82028 40.9025,20.8125 40.8975,20.80778 40.89611,20.79778 40.89722,20.78528 40.90167,20.77694 40.90139,20.77389 40.90278,20.75778 40.90111,20.75361 40.9025,20.75083 40.90472,20.74806 40.905,20.73167 40.91167,20.70472 40.98917,20.70028 41.00889,20.66972 41.08722,20.63222 41.08639,20.62972 41.08778,20.61361 41.08917,20.59556 41.0925,20.59361 41.09611,20.59278 41.10056,20.59 41.10417,20.58556 41.1075,20.58222 41.11333,20.5825 41.11444,20.58583 41.11639,20.58778 41.11889,20.58889 41.12139,20.58806 41.12389,20.59361 41.12528,20.59694 41.12778,20.59639 41.13167,20.59333 41.13528,20.59444 41.13694,20.59361 41.1375,20.59056 41.13861,20.59056 41.14167,20.58972 41.14306,20.58611 41.14722,20.58306 41.14889,20.58222 41.15194,20.5825 41.15694,20.57667 41.16167,20.57556 41.16389,20.57333 41.16583,20.57333 41.16694,20.56917 41.16889,20.56972 41.16972,20.56861 41.17194,20.56361 41.17889,20.55833 41.1825,20.55972 41.18444,20.55972 41.18694,20.56056 41.18806,20.55861 41.19167,20.55861 41.19306,20.55806 41.19361,20.55556 41.19306,20.55389 41.19083,20.54778 41.19361,20.54639 41.19528,20.54278 41.19694,20.54167 41.19667,20.54167 41.195,20.53778 41.19528,20.53722 41.19722,20.53472 41.19861,20.53472 41.19944,20.53361 41.19944,20.53167 41.20278,20.53222 41.20667,20.53083 41.21222,20.52944 41.21333,20.52833 41.21611,20.52333 41.21944,20.52333 41.22167,20.52139 41.22639,20.52028 41.22778,20.51778 41.22861,20.51528 41.23167,20.51528 41.23306,20.51694 41.23556,20.51611 41.2375,20.51694 41.24056,20.52139 41.24556,20.52139 41.24639,20.51889 41.24833,20.51861 41.25,20.51472 41.25528,20.51444 41.25833,20.51611 41.26,20.51444 41.26056,20.51194 41.26444,20.5125 41.26833,20.51056 41.27806,20.51278 41.28028,20.51444 41.28361,20.51444 41.28694,20.50944 41.28972,20.50889 41.2925,20.50778 41.29389,20.50722 41.2975,20.50917 41.29944,20.50944 41.30194,20.50667 41.30417,20.50694 41.31056,20.50417 41.31444,20.49889 41.32139,20.49944 41.32722,20.49361 41.32972,20.49111 41.33278,20.49361 41.33333,20.49444 41.33528,20.49889 41.3375,20.49722 41.33972,20.49694 41.34389,20.49778 41.34528,20.5 41.34667,20.50361 41.34611,20.51139 41.34167,20.51611 41.33667,20.52056 41.33833,20.52194 41.34083,20.52583 41.34306,20.52667 41.34389,20.52639 41.34722,20.5275 41.34833,20.52694 41.35389,20.53667 41.35833,20.5375 41.36056,20.53667 41.36139,20.53667 41.36306,20.54028 41.36611,20.54028 41.36778,20.54361 41.36944,20.54528 41.37222,20.54833 41.37333,20.55111 41.37639,20.55167 41.37917,20.54556 41.38417,20.54583 41.385,20.54917 41.38639,20.55028 41.38833,20.55 41.39056,20.55222 41.39333,20.55194 41.39611,20.555 41.40083,20.55667 41.40139,20.56111 41.40278,20.55889 41.4125,20.55694 41.41417,20.55722 41.41667,20.53861 41.42694,20.53972 41.42917,20.54028 41.43333,20.53944 41.43583,20.53722 41.43667,20.52889 41.43583,20.52306 41.43861,20.51917 41.43806,20.51806 41.43722,20.515 41.43833,20.51306 41.43778,20.51222 41.44028,20.50889 41.44278,20.50806 41.44417,20.50833 41.44667,20.51028 41.44778,20.51222 41.45056,20.51083 41.45333,20.50833 41.455,20.50778 41.45778,20.50472 41.46417,20.50361 41.46639,20.50222 41.46722,20.50306 41.47556,20.49639 41.48778,20.49361 41.49139,20.48944 41.49333,20.48417 41.49361,20.4825 41.49444,20.47972 41.49806,20.47722 41.49806,20.47222 41.49611,20.46917 41.49694,20.46861 41.49861,20.46972 41.50139,20.47639 41.50611,20.47722 41.50694,20.47667 41.50806,20.47111 41.50972,20.46278 41.50861,20.46083 41.51028,20.45583 41.5125,20.45361 41.51472,20.45361 41.51667,20.4525 41.51889,20.45333 41.52194,20.45528 41.52444,20.46056 41.52861,20.46889 41.52889,20.47111 41.53,20.47306 41.53222,20.47083 41.54167,20.46861 41.54306,20.46778 41.54472,20.4625 41.54583,20.46222 41.54917,20.45861 41.54972,20.45694 41.55111,20.45694 41.55333,20.47028 41.55889,20.48528 41.55917,20.48806 41.55806,20.49472 41.56111,20.50389 41.56278,20.50861 41.56444,20.51806 41.56333,20.52222 41.56556,20.52472 41.56556,20.52833 41.56917,20.53444 41.57222,20.54278 41.57833,20.54667 41.57806,20.55083 41.58056,20.55778 41.58222,20.55667 41.58444,20.55556 41.5925,20.55278 41.59639,20.555 41.60083,20.55444 41.6025,20.54944 41.60611,20.54722 41.60833,20.54667 41.615,20.54278 41.61861,20.54222 41.62,20.54083 41.62028,20.54333 41.62139,20.54361 41.62278,20.54167 41.62389,20.53583 41.63083,20.53139 41.63333,20.52528 41.635,20.52444 41.63611,20.52722 41.64056,20.5275 41.64694,20.52583 41.64972,20.52667 41.65194,20.51667 41.66167,20.51972 41.66528,20.52583 41.67667,20.52972 41.68944,20.52806 41.69056,20.5275 41.6925,20.52806 41.69639,20.52694 41.70583,20.51806 41.715,20.51694 41.71611,20.51556 41.72139,20.51389 41.72278,20.515 41.725,20.51444 41.72667,20.515 41.73194,20.51889 41.73472,20.51944 41.74111,20.51889 41.74611,20.51972 41.74889,20.51917 41.75056,20.52417 41.75528,20.52556 41.75944,20.53056 41.76667,20.53444 41.76889,20.53583 41.77306,20.53278 41.77528,20.53222 41.77667,20.53833 41.77944,20.54278 41.77944,20.54444 41.78028,20.54722 41.78472,20.54639 41.79,20.55361 41.78917,20.56556 41.78583,20.56917 41.78611,20.57222 41.78917,20.57278 41.79194,20.57222 41.795,20.57361 41.79806,20.57056 41.79972,20.56972 41.80139,20.56722 41.81639,20.56389 41.82083,20.56028 41.82306,20.55944 41.82389,20.56139 41.82972,20.56139 41.83611,20.56278 41.83861,20.56361 41.84333,20.56 41.85861,20.55944 41.86472,20.56056 41.86833,20.56139 41.86917,20.56833 41.87111,20.57139 41.87417,20.57361 41.875,20.58667 41.87556,20.59361 41.87694,20.89556 42.09694,21.32694 42.13667,21.78333 42.28333,22.10556 42.29944,22.36 42.31222,22.3675 42.30861,22.37139 42.30889,22.37361 42.3075,22.3775 42.30917,22.37889 42.30889,22.38139 42.30667,22.38167 42.305,22.38417 42.30361,22.38583 42.30139,22.38833 42.29861,22.38917 42.29472,22.39861 42.29194,22.40194 42.29,22.39944 42.28444,22.40417 42.27944,22.405 42.2775,22.40944 42.27528,22.41028 42.27278,22.41361 42.27083,22.41389 42.26889,22.41556 42.26694,22.42028 42.26417,22.42389 42.26444,22.42472 42.26056,22.42472 42.25611,22.43472 42.25806,22.43528 42.25556,22.43917 42.2525,22.43917 42.24778,22.44361 42.245,22.44972 42.24278,22.45056 42.24056,22.44833 42.23639,22.45083 42.23472,22.45139 42.23278,22.45528 42.22944,22.45639 42.2275,22.45722 42.22222,22.45972 42.22139,22.45944 42.21806,22.46222 42.21611,22.46194 42.21472,22.46778 42.21,22.46833 42.20722,22.46972 42.20389,22.46889 42.20111,22.48611 42.20139,22.49194 42.19861,22.49917 42.19667,22.50167 42.19583,22.50417 42.19194,22.50417 42.19056,22.50222 42.18889,22.50139 42.18639,22.50194 42.18333,22.505 42.17861,22.50556 42.16972,22.50861 42.16556,22.51056 42.16444,22.51667 42.15806,22.515 42.1575,22.51194 42.15611,22.51056 42.15444,22.51306 42.15222,22.52389 42.14694,22.52833 42.14,22.54 42.13583,22.54861 42.13444,22.55389 42.12889,22.55722 42.12778,22.55889 42.12528,22.5625 42.12417,22.56417 42.12083,22.56528 42.11861,22.57194 42.11556,22.57528 42.11278,22.58028 42.11028,22.58444 42.10889,22.59056 42.11,22.59306 42.10806,22.59528 42.105,22.59583 42.10278,22.60111 42.09778,22.60639 42.09778,22.61222 42.09444,22.61806 42.09694,22.63083 42.09361,22.635 42.08944,22.63806 42.08889,22.64167 42.08583,22.64444 42.08472,22.6475 42.08083,22.65083 42.08028,22.65083 42.07667,22.65167 42.07611,22.65611 42.07528,22.66278 42.07222,22.66528 42.07028,22.67028 42.07028,22.67528 42.06472,22.67861 42.06444,22.68 42.06333,22.68278 42.06333,22.68472 42.06472,22.68639 42.06333,22.68833 42.06472,22.69361 42.06333,22.69861 42.06333,22.7 42.06444,22.70472 42.06556,22.71222 42.06778,22.71583 42.06778,22.71889 42.07,22.7175 42.06722,22.71806 42.06389,22.72194 42.06194,22.72444 42.05889,22.72722 42.05889,22.72861 42.05806,22.72833 42.05528,22.73444 42.04722,22.74139 42.04472,22.74444 42.045,22.74722 42.04667,22.74889 42.04611,22.75083 42.04667,22.75389 42.04389,22.76278 42.04306,22.77083 42.04083,22.77278 42.03889,22.77806 42.03806,22.77889 42.03806,22.77944 42.03667,22.78278 42.03694,22.78444 42.03806,22.78611 42.03722,22.79278 42.03806,22.79528 42.04056,22.7975 42.04139,22.79806 42.04444,22.79944 42.04639,22.80278 42.04139,22.81528 42.02806,22.82028 42.02389,22.82528 42.02139,22.83778 42.01972,22.84194 42.02,22.84667 42.02111,22.85222 42.02444,22.85417 42.02444,22.85694 42.02167,22.85944 42.02111,22.86556 42.02222,22.86667 42.02056,22.8675 42.01556,22.86639 42.01194,22.86472 42.01,22.85917 42.005,22.85944 42.00333,22.86639 42.00111,22.87167 41.99806,22.87528 41.99722,22.87528 41.995,22.87389 41.99278,22.87528 41.99028,22.87389 41.98472,22.87472 41.98333,22.87389 41.97861,22.87806 41.97611,22.87583 41.97,22.87639 41.96889,22.87583 41.96139,22.87333 41.95528,22.87444 41.95361,22.87472 41.94917,22.87611 41.94806,22.87417 41.94528,22.87778 41.94306,22.87694 41.94028,22.87333 41.93639,22.8775 41.93306,22.87944 41.92556,22.88389 41.92083,22.88833 41.92056,22.89111 41.91944,22.89444 41.91361,22.89333 41.91167,22.89361 41.91028,22.89694 41.90583,22.89861 41.90472,22.89917 41.90333,22.89667 41.89833,22.8975 41.89667,22.89722 41.895,22.90139 41.89194,22.89944 41.89,22.89889 41.88694,22.90139 41.88194,22.90083 41.87917,22.90194 41.87639,22.90722 41.87528,22.90972 41.8775,22.915 41.87667,22.91583 41.875,22.91806 41.87389,22.92 41.87056,22.92306 41.86806,22.92528 41.86389,22.92778 41.86222,22.92667 41.86,22.93056 41.85528,22.93028 41.85333,22.93139 41.85028,22.93306 41.84944,22.93333 41.84833,22.93722 41.84694,22.93556 41.84417,22.93556 41.8425,22.94 41.83667,22.93972 41.83472,22.94167 41.83222,22.94306 41.82833,22.94083 41.82306,22.94083 41.81889,22.94111 41.81611,22.945 41.81306,22.94722 41.80556,22.95306 41.80194,22.95306 41.79861,22.955 41.795,22.96028 41.79028,22.9625 41.78917,22.96444 41.78944,22.96528 41.77917,22.96222 41.77639,22.96361 41.77389,22.96972 41.77056,22.97139 41.77056,22.97306 41.77222,22.975 41.77167,22.98194 41.76944,22.98944 41.77139,22.99 41.76944,22.99222 41.76722,22.99583 41.7675,22.99944 41.76972,23.00306 41.76861,23.00806 41.76917,23.01 41.76583,23.01056 41.7625,23.0125 41.76083,23.01306 41.75917,23.01583 41.7575,23.01556 41.75472,23.01611 41.75417,23.015 41.75194,23.01556 41.75028,23.01861 41.74833,23.02139 41.74833,23.02306 41.74417,23.02389 41.74,23.02667 41.73722,23.02861 41.73167,23.03139 41.72944,23.03139 41.72583,23.03389 41.7225,23.03139 41.71944,23.03139 41.71667,23.0325 41.71222,23.03417 41.70944,23.03167 41.7075,23.02917 41.70694,23.02667 41.7025,23.0225 41.70278,23.01139 41.68833,23.00861 41.68556,23.00889 41.68389,23.00778 41.68222,23.00417 41.68167,22.99417 41.67333,22.99278 41.66944,22.99 41.66611,22.99028 41.66389,22.98778 41.66333,22.98778 41.66083,22.98556 41.65806,22.9825 41.65778,22.98167 41.65694,22.98222 41.65417,22.98444 41.6525,22.98389 41.6475,22.98167 41.64694,22.97944 41.64861,22.97472 41.64694,22.96528 41.64833,22.96 41.64694,22.95944 41.64806,22.95833 41.64722,22.9575 41.64417,22.95361 41.6425,22.95139 41.6425,22.95083 41.63583,22.94806 41.6325,22.94861 41.63111,22.95278 41.6275,22.95333 41.625,22.95222 41.62222,22.95417 41.61917,22.95278 41.61528,22.95333 41.6125,22.95111 41.61,22.95139 41.60833,22.95056 41.60639,22.95194 41.60333,22.95 41.6,22.94972 41.59583,22.9525 41.58611,22.96028 41.58472,22.96111 41.58194,22.96583 41.57778,22.96472 41.57583,22.96611 41.57306,22.96611 41.56944,22.96889 41.56444,22.9725 41.56333,22.97278 41.55972,22.96861 41.55417,22.96944 41.55194,22.96972 41.54333,22.96833 41.5425,22.96444 41.54306,22.96 41.54194,22.96 41.53778,22.95833 41.53444,22.96306 41.52444,22.97028 41.5175,22.97111 41.515,22.97 41.51222,22.97028 41.50917,22.96944 41.50806,22.96917 41.50361,22.96167 41.49972,22.96083 41.49861,22.95778 41.49389,22.96111 41.49139,22.95972 41.48917,22.96194 41.48361,22.96139 41.47694,22.96722 41.47417,22.96583 41.46833,22.96417 41.46528,22.96667 41.46028,22.97528 41.45389,22.97944 41.44667,22.97722 41.44222,22.97361 41.43917,22.96833 41.43083,22.96361 41.43139,22.95889 41.42694,22.9525 41.41833,22.9525 41.41667,22.95444 41.41194,22.96083 41.40833,22.96111 41.40417,22.96611 41.39444,22.96333 41.38861,22.96194 41.38278,22.96194 41.37972,22.96333 41.37528,22.96333 41.36889,22.965 41.365,22.96472 41.35583,22.96333 41.35306,22.95111 41.3525,22.94472 41.34667)))'::geography AS border
)
SELECT id, ST_Distance(line, border), _ST_DistanceTree(line, border), ST_Intersects(line, border), ST_AsText(ST_Intersection(line, border))
FROM segment_line, borders
--WHERE id = 2
