<pre>Hi Nico,<br><br>Many thanks, I think this is the right way. :)<br><br>But there is some trouble :(<br><br>I will try with this code:<br><br>create and fill two tale (polygon and linestrings)<br><br>drop table if exists _test_mpoly;<br>
delete from geometry_columns where f_table_schema='public' and f_table_name='_test_mpoly';<br>create table _test_mpoly (id serial primary key);<br>SELECT AddGeometryColumn('_test_mpoly', 'geom', 3003, 'MULTIPOLYGON', 2);<br>
insert into _test_mpoly (geom) values ( ST_GeomFromText('MULTIPOLYGON( ((4 8, 7 9, 10 7, 9 4, 6 1, 3 2, 2 3, 1 6, 4 8)))',3003 ));<br><br>drop table if exists _test_line;<br>delete from geometry_columns where f_table_schema='public' and f_table_name='_test_line';<br>
create table _test_line (id serial primary key,verso integer);<br><br>SELECT AddGeometryColumn('_test_line', 'geom', 3003, 'LINESTRING', 2);<br>insert into _test_line (geom) values ( ST_GeomFromText('LINESTRING(2 3, 3 2, 6 1)',3003 )); // <br>
insert into _test_line (geom) values ( ST_GeomFromText('LINESTRING(6 1, 3 2, 2 3)',3003 )); // opposite to theb other line<br><br>As notable I insert in the linestring table 2 lines with opposite versus.<br><br>After this I try next sql select with the ST_OrderingEquals function.<br>
<br>select<br> <a href="http://a.id">a.id</a> as id,<br> case<br> when ST_OrderingEquals(a.geom,c.geom)=true then 1<br> else 0<br> end as versus<br>from<br> public._test_line as a,<br> (select ST_Boundary(b.geom) as geom from public._test_mpoly as b) as c<br>
where<br> ST_Intersects(a.geom,c.geom)=true<br><br>The results I will hope was<br>0 (first linestring is opposite versus to boundary polygon)<br>1 (second linestring is same versus to boundary polygon)<br><br><br>But the received results are<br>
0<br>0<br><br>:(<br><br>I don't understand what is wrongly.<br><br><br>Regards, Andrea.<br><br><br><br>>Ok, so maybe you could rebuild polygons from the linestrings and test<br>>these polygons ?<br>><br>>select st_orderingEquals(<br>
> st_makepolygon(geom),<br>> st_forceRHR(st_makepolygon(geom))) from<br>><br>>(select geometryFromText('LINESTRING (0 0, 1 0, 1 1, 0 1, 0 0)', -1) as geom<br>>union<br>>select geometryFromText('LINESTRING (2 2, 2 3, 3 3, 3 2, 2 2)', -1) as<br>
>geom) as foo<br>>;<br>><br>>Nico<br></pre><br clear="all"><br>-- <br>-----------------<br>Andrea Peri<br>. . . . . . . . . <br>qwerty אטלעש<br>-----------------<br><br>