Hi All,<br>I was trying to do this intersection between two tables, I have inserted the selects for the two tables and the error. Also the postgis full version information. <br>Is there a way to get around this problem? Is this a bug? The polygons in both tables contain 3D points. Could this be a problem?<br>
<br>Cheers,<br>Ed<br><br>select <a href="http://a.id">a.id</a>, ST_AsText(st_intersection(a.geomtext, b.geomtext)) the_tris<br>from small_tris a, vfaces b<br>where st_intersects (a.geomtext, b.geomtext);<br><br><span style="background-color:rgb(255,255,255);color:rgb(255,0,0)">ERROR: Error performing intersection: TopologyException: found non-noded intersection between LINESTRING (593907 5.2196e+06, 593915 5.21961e+06) and LINESTRING (593911 5.21961e+06, 593908 5.2196e+06) at 593908.59999999998 5219602 809.89999999999918</span><br style="background-color:rgb(255,255,255);color:rgb(255,0,0)">
<br style="background-color:rgb(255,255,255);color:rgb(255,0,0)"><span style="background-color:rgb(255,255,255);color:rgb(255,0,0)">********** Error **********</span><br style="background-color:rgb(255,255,255);color:rgb(255,0,0)">
<br style="background-color:rgb(255,255,255);color:rgb(255,0,0)"><span style="background-color:rgb(255,255,255);color:rgb(255,0,0)">ERROR: Error performing intersection: TopologyException: found non-noded intersection between LINESTRING (593907 5.2196e+06, 593915 5.21961e+06) and LINESTRING (593911 5.21961e+06, 593908 5.2196e+06) at 593908.59999999998 5219602 809.89999999999918</span><br style="background-color:rgb(255,255,255);color:rgb(255,0,0)">
<span style="background-color:rgb(255,255,255);color:rgb(255,0,0)">SQL state: XX000</span><br style="background-color:rgb(255,0,0)"><br><br> SELECT PostGIS_full_version(); <br>
postgis_full_version
<br>
<br>
--------------------------------------------------------------------------------------------------------------------------------------------<br>
-----------<br>
POSTGIS="2.0.0alpha7SVN" GEOS="3.3.2-CAPI-1.7.2" PROJ="Rel. 4.7.1, 23
September 2009" GDAL="GDAL 1.9.0, released 2011/12/29" LIBXML="2.7.8"<br>
USE_STATS<br>
(1 row)<br>
<br><br>bounds=# select gen_id, ST_AsText(geomtext) from vfaces;<br> gen_id | st_astext <br>--------+---------------------------------------------------------------------------------------------------------------------------------<br>
7 | POLYGON Z ((593908 5219600 803,593907 5219600 818,593915 5219610 818,593911 5219610 803,593908 5219600 803))<br> 7 | POLYGON Z ((593908 5219600 803,593899 5219600 803,593899 5219600 818,593907 5219600 818,593908 5219600 803))<br>
7 | POLYGON Z ((593908 5219600 803,593911 5219610 803,593903 5219620 803,593899 5219620 803,593899 5219600 803,593908 5219600 803))<br> 7 | POLYGON Z ((593899 5219620 803,593899 5219620 818,593899 5219600 818,593899 5219600 803,593899 5219620 803))<br>
7 | POLYGON Z ((593899 5219620 803,593903 5219620 803,593912 5219620 818,593899 5219620 818,593899 5219620 803))<br> 7 | POLYGON Z ((593912 5219620 818,593903 5219620 803,593911 5219610 803,593915 5219610 818,593912 5219620 818))<br>
7 | POLYGON Z ((593912 5219620 818,593915 5219610 818,593907 5219600 818,593899 5219600 818,593899 5219620 818,593912 5219620 818))<br> 16 | POLYGON Z ((593921 5219600 803,593921 5219610 803,593911 5219610 803,593908 5219600 803,593921 5219600 803))<br>
16 | POLYGON Z ((593921 5219600 803,593921 5219600 818,593921 5219610 818,593921 5219610 803,593921 5219600 803))<br> 16 | POLYGON Z ((593921 5219600 803,593908 5219600 803,593907 5219600 818,593921 5219600 818,593921 5219600 803))<br>
16 | POLYGON Z ((593911 5219610 803,593921 5219610 803,593921 5219610 818,593915 5219610 818,593911 5219610 803))<br> 16 | POLYGON Z ((593911 5219610 803,593915 5219610 818,593907 5219600 818,593908 5219600 803,593911 5219610 803))<br>
16 | POLYGON Z ((593907 5219600 818,593915 5219610 818,593921 5219610 818,593921 5219600 818,593907 5219600 818))<br> 18 | POLYGON Z ((593921 5219610 803,593911 5219610 803,593915 5219610 818,593921 5219610 818,593921 5219610 803))<br>
18 | POLYGON Z ((593921 5219610 803,593921 5219620 803,593903 5219620 803,593911 5219610 803,593921 5219610 803))<br> 18 | POLYGON Z ((593921 5219610 803,593921 5219610 818,593921 5219620 818,593921 5219620 803,593921 5219610 803))<br>
18 | POLYGON Z ((593912 5219620 818,593915 5219610 818,593911 5219610 803,593903 5219620 803,593912 5219620 818))<br> 18 | POLYGON Z ((593912 5219620 818,593921 5219620 818,593921 5219610 818,593915 5219610 818,593912 5219620 818))<br>
18 | POLYGON Z ((593912 5219620 818,593903 5219620 803,593921 5219620 803,593921 5219620 818,593912 5219620 818))<br>(19 rows)<br><br>bounds=# select id, st_astext(geomtext) from small_tris;<br> id | st_astext <br>
----+-------------------------------------------------------------------------------------------<br> 0 | POLYGON Z ((593890 5219590 840,593900 5219590 827,593890 5219600 817,593890 5219590 840))<br> 1 | POLYGON Z ((593890 5219600 817,593900 5219590 827,593900 5219600 815,593890 5219600 817))<br>
2 | POLYGON Z ((593900 5219600 815,593910 5219590 824,593910 5219600 815,593900 5219600 815))<br> 3 | POLYGON Z ((593910 5219590 824,593900 5219600 815,593900 5219590 827,593910 5219590 824))<br> 4 | POLYGON Z ((593910 5219600 815,593910 5219590 824,593920 5219590 842,593910 5219600 815))<br>
5 | POLYGON Z ((593900 5219600 815,593910 5219600 815,593900 5219610 815,593900 5219600 815))<br> 6 | POLYGON Z ((593890 5219600 817,593900 5219600 815,593900 5219610 815,593890 5219600 817))<br> 7 | POLYGON Z ((593890 5219620 812,593890 5219610 825,593900 5219610 815,593890 5219620 812))<br>
8 | POLYGON Z ((593890 5219630 827,593890 5219620 812,593900 5219620 841,593890 5219630 827))<br> 9 | POLYGON Z ((593900 5219610 815,593900 5219620 841,593890 5219620 812,593900 5219610 815))<br> 10 | POLYGON Z ((593910 5219610 819,593900 5219620 841,593900 5219610 815,593910 5219610 819))<br>
11 | POLYGON Z ((593910 5219620 848,593900 5219630 838,593900 5219620 841,593910 5219620 848))<br> 12 | POLYGON Z ((593900 5219620 841,593900 5219630 838,593890 5219630 827,593900 5219620 841))<br> 13 | POLYGON Z ((593890 5219610 825,593890 5219600 817,593900 5219610 815,593890 5219610 825))<br>
14 | POLYGON Z ((593910 5219610 819,593900 5219610 815,593910 5219600 815,593910 5219610 819))<br> 15 | POLYGON Z ((593910 5219600 815,593920 5219600 817,593910 5219610 819,593910 5219600 815))<br> 16 | POLYGON Z ((593920 5219600 817,593910 5219600 815,593920 5219590 842,593920 5219600 817))<br>
17 | POLYGON Z ((593920 5219600 817,593920 5219590 842,593930 5219590 803,593920 5219600 817))<br> 18 | POLYGON Z ((593910 5219610 819,593920 5219600 817,593920 5219610 804,593910 5219610 819))<br> 19 | POLYGON Z ((593920 5219600 817,593930 5219600 845,593920 5219610 804,593920 5219600 817))<br>
20 | POLYGON Z ((593930 5219600 845,593920 5219600 817,593930 5219590 803,593930 5219600 845))<br> 21 | POLYGON Z ((593920 5219610 804,593930 5219600 845,593930 5219610 819,593920 5219610 804))<br> 22 | POLYGON Z ((593910 5219610 819,593920 5219610 804,593920 5219620 804,593910 5219610 819))<br>
23 | POLYGON Z ((593910 5219620 848,593920 5219620 804,593910 5219630 801,593910 5219620 848))<br> 24 | POLYGON Z ((593910 5219620 848,593910 5219610 819,593920 5219620 804,593910 5219620 848))<br> 25 | POLYGON Z ((593910 5219630 801,593920 5219620 804,593920 5219630 808,593910 5219630 801))<br>
26 | POLYGON Z ((593910 5219620 848,593910 5219630 801,593900 5219630 838,593910 5219620 848))<br> 27 | POLYGON Z ((593930 5219620 844,593920 5219630 808,593920 5219620 804,593930 5219620 844))<br> 28 | POLYGON Z ((593930 5219630 834,593920 5219630 808,593930 5219620 844,593930 5219630 834))<br>
29 | POLYGON Z ((593930 5219620 844,593920 5219620 804,593930 5219610 819,593930 5219620 844))<br> 30 | POLYGON Z ((593920 5219610 804,593930 5219610 819,593920 5219620 804,593920 5219610 804))<br> 31 | POLYGON Z ((593910 5219610 819,593910 5219620 848,593900 5219620 841,593910 5219610 819))<br>
(32 rows)<br><br><br><div class="gmail_quote">On Mon, Oct 29, 2012 at 3:37 PM, Ed Linde <span dir="ltr"><<a href="mailto:edolinde@gmail.com" target="_blank">edolinde@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi All,<br>Thanks for the tips! Just another thing, when I compute the "transition points" on each edge (shown as red points in my pdf).<br>I need to join them to make a polygon. Wondering how I can connect them together so that I start with a point and end on it<br>
to form a closed polygon? <br><br>Cheers,<br>Ed<div class="HOEnZb"><div class="h5"><br><br><div class="gmail_quote">On Mon, Oct 29, 2012 at 3:03 PM, Stephen Woodbridge <span dir="ltr"><<a href="mailto:woodbri@swoodbridge.com" target="_blank">woodbri@swoodbridge.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Ed,<br>
<br>
Well if clarifies one thing at least, you can ignore Mike's st_Relate because 5 is not adjacent to a linear edge, it is only adjacent to a vertex, so st_touches should work fine.<br>
<br>
so you are looking for:<br>
<br>
1. a specific triangle by id<br>
2. that intersects triangle VC<br>
3. and the triangles adjacent to triangle by id<br>
4. and those that are contained in VC<br>
5. sorted by distance to P1 limit 1<br>
<br>
so something like:<br>
<br>
select id, the_geom<br>
from (select id, the_geom as adjacent<br>
from triangles<br>
where st_touches(the_geom,<br>
(select the_geom<br>
from triangles a,<br>
(select the_geom as vc<br>
from vc_table<br>
where id='p1') b<br>
where <a href="http://a.id" target="_blank">a.id</a>=4)) c<br>
order by st_distance(c.the_geom, (select the_geom<br>
from points<br>
where id='p1')) asc limit 1;<br>
<br>
Untested, but should give you a model to work with.<br>
<br>
-Steve W<div><br>
<br>
<br>
On 10/29/2012 6:57 AM, Ed Linde wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>
Attached is a figure. Where the dotted line is the boundary of the<br>
voronoi cell whose<br>
generator is point P1. So triangle "4" intersects with the voronoi<br>
boundary, but we are<br>
interested in the adjacent triangles of triangle 4, which are closer to<br>
point P1.<br>
For example, triangle 5.<br>
<br>
Hope this helps.<br>
Cheers,<br>
Ed<br>
<br>
On Mon, Oct 29, 2012 at 11:50 AM, Nicolas Ribot <<a href="mailto:nicolas.ribot@gmail.com" target="_blank">nicolas.ribot@gmail.com</a><br></div><div>
<mailto:<a href="mailto:nicolas.ribot@gmail.com" target="_blank">nicolas.ribot@gmail.<u></u>com</a>>> wrote:<br>
<br>
Could you draw a figure ?<br>
<br>
Nicolas<br>
<br>
On 29 October 2012 11:03, Ed Linde <<a href="mailto:edolinde@gmail.com" target="_blank">edolinde@gmail.com</a><br></div><div><div>
<mailto:<a href="mailto:edolinde@gmail.com" target="_blank">edolinde@gmail.com</a>>> wrote:<br>
> Hi All,<br>
> Thanks for the suggestions.<br>
> For 1) I will look into how ST_touches works and see if it can<br>
pick up all<br>
> the adjacent polygons to<br>
> the one I have. And also look into Mike's suggestion on<br>
ST_relate...though I<br>
> must admit it looks<br>
> more complex.<br>
> For 2) I will try to clarify it a bit more... its harder to do<br>
without a<br>
> figure :) but here goes.<br>
><br>
> Lets say we have a point Q which is the generator of a voronoi<br>
cell. Now I<br>
> compute the<br>
> intersection between the voronoi cell boundaries and my<br>
triangulation (Set<br>
> of polygons)<br>
> using ST_intersect. Once I have these triangles.. I say pick one<br>
triangle T<br>
> that is<br>
> intersecting the voronoi cell boundary of Q.<br>
> For all the triangles adjacent to T, I need to know which<br>
triangles are<br>
> INSIDE the voronoi<br>
> boundary (closer to Q) and which adjacent triangles are just<br>
OUTSIDE the<br>
> voronoi<br>
> boundary (farther from Q). I am basically testing for a certain<br>
property by<br>
> "shrinking" the<br>
> voronoi cell (closer to Q) and another property when "expanding"<br>
the voronoi<br>
> cell (away from Q).<br>
> Just need to make this division of triangles. Haven't thought of<br>
a nice way<br>
> to do this in postgis 2.0<br>
> So any suggestions would greatly help.<br>
><br>
> Thanks,<br>
> Ed<br>
><br>
> On Mon, Oct 29, 2012 at 10:15 AM, Mike Toews <<a href="mailto:mwtoews@gmail.com" target="_blank">mwtoews@gmail.com</a><br></div></div><div>
<mailto:<a href="mailto:mwtoews@gmail.com" target="_blank">mwtoews@gmail.com</a>>> wrote:<br>
>><br>
>> On 29 October 2012 21:33, Ed Linde <<a href="mailto:edolinde@gmail.com" target="_blank">edolinde@gmail.com</a><br></div><div>
<mailto:<a href="mailto:edolinde@gmail.com" target="_blank">edolinde@gmail.com</a>>> wrote:<br>
>> > Hi All,<br>
>> > I need help with 2 hard problems. I store triangles in a table as<br>
>> > POLYGON.<br>
>> ><br>
>> > 1. I want to know for a given triangle, which triangles share<br>
an edge<br>
>> > (adjacent) with this triangle.<br>
>><br>
>> Sounds like you have a finite element mesh with nodes and elements.<br>
>> You can use ST_Relate with pattern 'FF2F11212' to pick out elements<br>
>> that share the same edge. This DE-9-IM is sort-of a custom<br>
ST_Touches,<br>
>> but only takes linear boundary overlaps. So if you have a table<br>
>> "elements", and you want to find ones that touch ID 567:<br>
>><br>
>> SELECT elements.*<br>
>> FROM elements, elements as e<br></div>
>> WHERE <a href="http://e.id" target="_blank">e.id</a> <<a href="http://e.id" target="_blank">http://e.id</a>> = 567 AND<div><br>
>> ST_Relate(elements.geom, e.geom, 'FF2F11212');<br>
>><br>
>> I'm not certain about your second question.<br>
>><br>
>> -Mike<br>
>> ______________________________<u></u>_________________<br>
>> postgis-users mailing list<br>
>> <a href="mailto:postgis-users@postgis.refractions.net" target="_blank">postgis-users@postgis.<u></u>refractions.net</a><br></div>
<mailto:<a href="mailto:postgis-users@postgis.refractions.net" target="_blank">postgis-users@postgis.<u></u>refractions.net</a>><div><br>
>> <a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.<u></u>net/mailman/listinfo/postgis-<u></u>users</a><br>
><br>
><br>
><br>
> ______________________________<u></u>_________________<br>
> postgis-users mailing list<br>
> <a href="mailto:postgis-users@postgis.refractions.net" target="_blank">postgis-users@postgis.<u></u>refractions.net</a><br></div>
<mailto:<a href="mailto:postgis-users@postgis.refractions.net" target="_blank">postgis-users@postgis.<u></u>refractions.net</a>><div><br>
> <a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.<u></u>net/mailman/listinfo/postgis-<u></u>users</a><br>
><br>
______________________________<u></u>_________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net" target="_blank">postgis-users@postgis.<u></u>refractions.net</a><br></div>
<mailto:<a href="mailto:postgis-users@postgis.refractions.net" target="_blank">postgis-users@postgis.<u></u>refractions.net</a>><div><br>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.<u></u>net/mailman/listinfo/postgis-<u></u>users</a><br>
<br>
<br>
<br>
<br>
______________________________<u></u>_________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net" target="_blank">postgis-users@postgis.<u></u>refractions.net</a><br>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.<u></u>net/mailman/listinfo/postgis-<u></u>users</a><br>
<br>
</div></blockquote><div><div>
<br>
______________________________<u></u>_________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net" target="_blank">postgis-users@postgis.<u></u>refractions.net</a><br>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.<u></u>net/mailman/listinfo/postgis-<u></u>users</a><br>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br>