[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgis-users
Subject:    Re: [postgis-users] Difficult Problem with Polygons
From:       Ed Linde <edolinde () gmail ! com>
Date:       2012-10-29 16:34:50
Message-ID: CAK4dkcU0Brtd+L3=52p20zvbfCfN3KNyTOf6fNxK3dbs4U8_Ug () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


I tried something like the following without removing the same points ad it
seems to work:

SELECT st_astext(ST_ConvexHull(ST_GeomFromText('MULTIPOINT(593901 5219610
814,593901 5219610 814,593899 5219610 814,593899 5219610 814,593901 5219610
814)')));
"LINESTRING Z (593901 5219610 814,593899 5219610 814)"

Ed

On Mon, Oct 29, 2012 at 5:23 PM, Nicolas Ribot <nicolas.ribot@gmail.com>wrote:

> You should filter out the consecutive points. If there are more than 2
> points, you can then call st_convexHull() on the point set:
>
> with points as (
>         select 'POINT (0 0)'::geometry as geom
>         UNION
>         select 'POINT (1 0)'::geometry as geom
>         UNION
>         select 'POINT (1 1)'::geometry as geom
> ) select st_convexHull(st_collect(geom))
> from points;
>
> If the points are aligned, convexHull will be a linestring, that you
> can discard or further process according to your needs.
>
> Nicolas
>
> On 29 October 2012 16:51, Ed Linde <edolinde@gmail.com> wrote:
> > Hi Nicolas,
> > It seems like sometimes the points are one and the same and I get
> > linestrings and not
> > actual polygons. I pass these points in from a perl script, so is there a
> > way I can just
> > give the raw x,y,z coordinates of these points and do a st_convexhull
> > function on them?
> > Could you please give me a small example?
> >
> > I tried something like:
> > The two coordinates marked in red and marked in orange are the same.
> >
> > bounds=# insert into vfaces values (1,
> > bounds(# ST_GeomFromText('POLYGON((593901 5219610 814,593901 5219610
> > 814,593899 5219610 814,593899 5219610 814,593901 5219610 814))') );
> > INSERT 0 1
> > bounds=# select st_isvalid(geomtext) from vfaces;
> > NOTICE:  Too few points in geometry component at or near point 593901
> > 5219610 814
> >
> >  st_isvalid
> > ------------
> >  f
> > (1 row)
> >
> > Thanks,
> > Ed
> >
> >
> >
> >
> > On Mon, Oct 29, 2012 at 4:26 PM, Ed Linde <edolinde@gmail.com> wrote:
> >>
> >> Ok thanks, will look into that function. Because I wonder if the s/w I
> am
> >> using is
> >> actually outputting the vertices of each face in a cyclical fashion or
> >> just
> >> arbitrarily.
> >>
> >> Cheers,
> >> Ed
> >>
> >>
> >> On Mon, Oct 29, 2012 at 4:23 PM, Nicolas Ribot <nicolas.ribot@gmail.com
> >
> >> wrote:
> >>>
> >>> Yes, it looks like some points were not put in the right order before
> >>> building a polygon, thus these "butterfly" polygons you generated.
> >>> If the formed polygon are expected to be convex, you could use
> >>> st_convexhull on the point cloud to generate the polygons.
> >>>
> >>> On 29 October 2012 16:09, Ed Linde <edolinde@gmail.com> wrote:
> >>> > Thanks Nicolas! Will look at the script that generated the polygon
> >>> > text..
> >>> > must have goofed something up there.
> >>> >
> >>> >
> >>> > On Mon, Oct 29, 2012 at 4:05 PM, Nicolas Ribot
> >>> > <nicolas.ribot@gmail.com>
> >>> > wrote:
> >>> >>
> >>> >> Hi,
> >>> >>
> >>> >> No. this is because some of your polygons are not valid:
> >>> >> for instance:
> >>> >> select st_isvalid('POLYGON  ((593921 5219610 803,593921 5219610
> >>> >> 818,593921 5219620 818,593921 5219620 803,593921 5219610
> >>> >> 803))'::geometry);
> >>> >> NOTICE:  Too few points in geometry component at or near point
> 593921
> >>> >> 5219610 803
> >>> >>  st_isvalid
> >>> >> ------------
> >>> >>  f
> >>> >> (1 row)
> >>> >>
> >>> >> you can control this with st_isvalid, st_isvalidReason and correct
> >>> >> them with st_makeValid.
> >>> >>
> >>> >> Use only valid objects before processing them with Postgis
> functions.
> >>> >>
> >>> >> Nicolas
> >>> >>
> >>> >> On 29 October 2012 16:03, Ed Linde <edolinde@gmail.com> wrote:
> >>> >> > Thanks Nicolas. Just about the error, is this because the line
> >>> >> > segments
> >>> >> > are
> >>> >> > too close
> >>> >> > and postgis 2.0 could not handle this? If so is there a
> workaround,
> >>> >> > even
> >>> >> > if
> >>> >> > it means
> >>> >> > slightly having to "perturb" each point's position to not run into
> >>> >> > this
> >>> >> > bug.
> >>> >> > I was really hoping that the intersection of two polygonal shapes
> in
> >>> >> > 3D
> >>> >> > would be fairly
> >>> >> > simple in postgis 2.0 :(
> >>> >> >
> >>> >> > Ed
> >>> >> >
> >>> >> >
> >>> >> > On Mon, Oct 29, 2012 at 4:00 PM, Nicolas Ribot
> >>> >> > <nicolas.ribot@gmail.com>
> >>> >> > wrote:
> >>> >> >>
> >>> >> >> If the points are computed in the right order, you can store them
> >>> >> >> and
> >>> >> >> pass them to st_makeLine and st_makePolygon.
> >>> >> >> If not, you can form a segment between 2 closest points and
> connect
> >>> >> >> it
> >>> >> >> to the closest points.
> >>> >> >>
> >>> >> >> On 29 October 2012 15:37, Ed Linde <edolinde@gmail.com> wrote:
> >>> >> >> > Hi All,
> >>> >> >> > Thanks for the tips! Just another thing, when I compute the
> >>> >> >> > "transition
> >>> >> >> > points" on each edge (shown as red points in my pdf).
> >>> >> >> > 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
> >>> >> >> > to form a closed polygon?
> >>> >> >> >
> >>> >> >> > Cheers,
> >>> >> >> > Ed
> >>> >> >> >
> >>> >> >> >
> >>> >> >> > On Mon, Oct 29, 2012 at 3:03 PM, Stephen Woodbridge
> >>> >> >> > <woodbri@swoodbridge.com> wrote:
> >>> >> >> >>
> >>> >> >> >> Hi Ed,
> >>> >> >> >>
> >>> >> >> >> 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.
> >>> >> >> >>
> >>> >> >> >> so you are looking for:
> >>> >> >> >>
> >>> >> >> >> 1. a specific triangle by id
> >>> >> >> >> 2. that intersects triangle VC
> >>> >> >> >> 3. and the triangles adjacent to triangle by id
> >>> >> >> >> 4. and those that are contained in VC
> >>> >> >> >> 5. sorted by distance to P1 limit 1
> >>> >> >> >>
> >>> >> >> >> so something like:
> >>> >> >> >>
> >>> >> >> >> select id, the_geom
> >>> >> >> >>   from (select id, the_geom as adjacent
> >>> >> >> >>           from triangles
> >>> >> >> >>          where st_touches(the_geom,
> >>> >> >> >>                           (select the_geom
> >>> >> >> >>                              from triangles a,
> >>> >> >> >>                                   (select the_geom as vc
> >>> >> >> >>                                      from vc_table
> >>> >> >> >>                                     where id='p1') b
> >>> >> >> >>                             where a.id=4)) c
> >>> >> >> >>  order by st_distance(c.the_geom, (select the_geom
> >>> >> >> >>                                      from points
> >>> >> >> >>                                     where id='p1')) asc limit
> 1;
> >>> >> >> >>
> >>> >> >> >> Untested, but should give you a model to work with.
> >>> >> >> >>
> >>> >> >> >> -Steve W
> >>> >> >> >>
> >>> >> >> >>
> >>> >> >> >>
> >>> >> >> >> On 10/29/2012 6:57 AM, Ed Linde wrote:
> >>> >> >> >>>
> >>> >> >> >>> Attached is a figure. Where the dotted line is the boundary
> of
> >>> >> >> >>> the
> >>> >> >> >>> voronoi cell whose
> >>> >> >> >>> generator is point P1. So triangle "4" intersects with the
> >>> >> >> >>> voronoi
> >>> >> >> >>> boundary, but we are
> >>> >> >> >>> interested in the adjacent triangles of triangle 4, which are
> >>> >> >> >>> closer
> >>> >> >> >>> to
> >>> >> >> >>> point P1.
> >>> >> >> >>> For example, triangle 5.
> >>> >> >> >>>
> >>> >> >> >>> Hope this helps.
> >>> >> >> >>> Cheers,
> >>> >> >> >>> Ed
> >>> >> >> >>>
> >>> >> >> >>> On Mon, Oct 29, 2012 at 11:50 AM, Nicolas Ribot
> >>> >> >> >>> <nicolas.ribot@gmail.com
> >>> >> >> >>> <mailto:nicolas.ribot@gmail.com>> wrote:
> >>> >> >> >>>
> >>> >> >> >>>     Could you draw a figure ?
> >>> >> >> >>>
> >>> >> >> >>>     Nicolas
> >>> >> >> >>>
> >>> >> >> >>>     On 29 October 2012 11:03, Ed Linde <edolinde@gmail.com
> >>> >> >> >>>     <mailto:edolinde@gmail.com>> wrote:
> >>> >> >> >>>      > Hi All,
> >>> >> >> >>>      > Thanks for the suggestions.
> >>> >> >> >>>      > For 1) I will look into how ST_touches works and see
> if
> >>> >> >> >>> it
> >>> >> >> >>> can
> >>> >> >> >>>     pick up all
> >>> >> >> >>>      > the adjacent polygons to
> >>> >> >> >>>      > the one I have. And also look into Mike's suggestion
> on
> >>> >> >> >>>     ST_relate...though I
> >>> >> >> >>>      > must admit it looks
> >>> >> >> >>>      > more complex.
> >>> >> >> >>>      > For 2) I will try to clarify it a bit more... its
> harder
> >>> >> >> >>> to
> >>> >> >> >>> do
> >>> >> >> >>>     without a
> >>> >> >> >>>      > figure :) but here goes.
> >>> >> >> >>>      >
> >>> >> >> >>>      > Lets say we have a point Q which is the generator of a
> >>> >> >> >>> voronoi
> >>> >> >> >>>     cell. Now I
> >>> >> >> >>>      > compute the
> >>> >> >> >>>      > intersection between the voronoi cell boundaries and
> my
> >>> >> >> >>>     triangulation (Set
> >>> >> >> >>>      > of polygons)
> >>> >> >> >>>      > using ST_intersect. Once I have these triangles.. I
> say
> >>> >> >> >>> pick
> >>> >> >> >>> one
> >>> >> >> >>>     triangle T
> >>> >> >> >>>      > that is
> >>> >> >> >>>      > intersecting the voronoi cell boundary of Q.
> >>> >> >> >>>      > For all the triangles adjacent to T, I need to know
> >>> >> >> >>> which
> >>> >> >> >>>     triangles are
> >>> >> >> >>>      > INSIDE the voronoi
> >>> >> >> >>>      > boundary (closer to Q) and which adjacent triangles
> are
> >>> >> >> >>> just
> >>> >> >> >>>     OUTSIDE the
> >>> >> >> >>>      > voronoi
> >>> >> >> >>>      > boundary (farther from Q). I am basically testing for
> a
> >>> >> >> >>> certain
> >>> >> >> >>>     property by
> >>> >> >> >>>      > "shrinking" the
> >>> >> >> >>>      > voronoi cell (closer to Q) and another property when
> >>> >> >> >>> "expanding"
> >>> >> >> >>>     the voronoi
> >>> >> >> >>>      > cell (away from Q).
> >>> >> >> >>>      > Just need to make this division of triangles. Haven't
> >>> >> >> >>> thought
> >>> >> >> >>> of
> >>> >> >> >>>     a nice way
> >>> >> >> >>>      > to do this in postgis 2.0
> >>> >> >> >>>      > So any suggestions would greatly help.
> >>> >> >> >>>      >
> >>> >> >> >>>      > Thanks,
> >>> >> >> >>>      > Ed
> >>> >> >> >>>      >
> >>> >> >> >>>      > On Mon, Oct 29, 2012 at 10:15 AM, Mike Toews
> >>> >> >> >>> <mwtoews@gmail.com
> >>> >> >> >>>     <mailto:mwtoews@gmail.com>> wrote:
> >>> >> >> >>>      >>
> >>> >> >> >>>      >> On 29 October 2012 21:33, Ed Linde <
> edolinde@gmail.com
> >>> >> >> >>>     <mailto:edolinde@gmail.com>> wrote:
> >>> >> >> >>>      >> > Hi All,
> >>> >> >> >>>      >> > I need help with 2 hard problems. I store triangles
> >>> >> >> >>> in a
> >>> >> >> >>> table
> >>> >> >> >>> as
> >>> >> >> >>>      >> > POLYGON.
> >>> >> >> >>>      >> >
> >>> >> >> >>>      >> > 1. I want to know for a given triangle, which
> >>> >> >> >>> triangles
> >>> >> >> >>> share
> >>> >> >> >>>     an edge
> >>> >> >> >>>      >> > (adjacent) with this triangle.
> >>> >> >> >>>      >>
> >>> >> >> >>>      >> Sounds like you have a finite element mesh with nodes
> >>> >> >> >>> and
> >>> >> >> >>> elements.
> >>> >> >> >>>      >> You can use ST_Relate with pattern 'FF2F11212' to
> pick
> >>> >> >> >>> out
> >>> >> >> >>> elements
> >>> >> >> >>>      >> that share the same edge. This DE-9-IM is sort-of a
> >>> >> >> >>> custom
> >>> >> >> >>>     ST_Touches,
> >>> >> >> >>>      >> but only takes linear boundary overlaps. So if you
> have
> >>> >> >> >>> a
> >>> >> >> >>> table
> >>> >> >> >>>      >> "elements", and you want to find ones that touch ID
> >>> >> >> >>> 567:
> >>> >> >> >>>      >>
> >>> >> >> >>>      >> SELECT elements.*
> >>> >> >> >>>      >> FROM elements, elements as e
> >>> >> >> >>>      >> WHERE e.id <http://e.id> = 567 AND
> >>> >> >> >>>
> >>> >> >> >>>      >>     ST_Relate(elements.geom, e.geom, 'FF2F11212');
> >>> >> >> >>>      >>
> >>> >> >> >>>      >> I'm not certain about your second question.
> >>> >> >> >>>      >>
> >>> >> >> >>>      >> -Mike
> >>> >> >> >>>      >> _______________________________________________
> >>> >> >> >>>      >> postgis-users mailing list
> >>> >> >> >>>      >> postgis-users@postgis.refractions.net
> >>> >> >> >>>     <mailto:postgis-users@postgis.refractions.net>
> >>> >> >> >>>
> >>> >> >> >>>      >>
> >>> >> >> >>>
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> >>> >> >> >>>      >
> >>> >> >> >>>      >
> >>> >> >> >>>      >
> >>> >> >> >>>      > _______________________________________________
> >>> >> >> >>>      > postgis-users mailing list
> >>> >> >> >>>      > postgis-users@postgis.refractions.net
> >>> >> >> >>>     <mailto:postgis-users@postgis.refractions.net>
> >>> >> >> >>>
> >>> >> >> >>>      >
> >>> >> >> >>>
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> >>> >> >> >>>      >
> >>> >> >> >>>     _______________________________________________
> >>> >> >> >>>     postgis-users mailing list
> >>> >> >> >>>     postgis-users@postgis.refractions.net
> >>> >> >> >>>     <mailto:postgis-users@postgis.refractions.net>
> >>> >> >> >>>
> >>> >> >> >>>
> >>> >> >> >>>
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> >>> >> >> >>>
> >>> >> >> >>>
> >>> >> >> >>>
> >>> >> >> >>>
> >>> >> >> >>> _______________________________________________
> >>> >> >> >>> postgis-users mailing list
> >>> >> >> >>> postgis-users@postgis.refractions.net
> >>> >> >> >>>
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> >>> >> >> >>>
> >>> >> >> >>
> >>> >> >> >> _______________________________________________
> >>> >> >> >> postgis-users mailing list
> >>> >> >> >> postgis-users@postgis.refractions.net
> >>> >> >> >> http://postgis.refractions.net/mailman/listinfo/postgis-users
> >>> >> >> >
> >>> >> >> >
> >>> >> >> >
> >>> >> >> > _______________________________________________
> >>> >> >> > postgis-users mailing list
> >>> >> >> > postgis-users@postgis.refractions.net
> >>> >> >> > http://postgis.refractions.net/mailman/listinfo/postgis-users
> >>> >> >> >
> >>> >> >> _______________________________________________
> >>> >> >> postgis-users mailing list
> >>> >> >> postgis-users@postgis.refractions.net
> >>> >> >> http://postgis.refractions.net/mailman/listinfo/postgis-users
> >>> >> >
> >>> >> >
> >>> >> >
> >>> >> > _______________________________________________
> >>> >> > postgis-users mailing list
> >>> >> > postgis-users@postgis.refractions.net
> >>> >> > http://postgis.refractions.net/mailman/listinfo/postgis-users
> >>> >> >
> >>> >> _______________________________________________
> >>> >> postgis-users mailing list
> >>> >> postgis-users@postgis.refractions.net
> >>> >> http://postgis.refractions.net/mailman/listinfo/postgis-users
> >>> >
> >>> >
> >>> >
> >>> > _______________________________________________
> >>> > postgis-users mailing list
> >>> > postgis-users@postgis.refractions.net
> >>> > http://postgis.refractions.net/mailman/listinfo/postgis-users
> >>> >
> >>> _______________________________________________
> >>> postgis-users mailing list
> >>> postgis-users@postgis.refractions.net
> >>> http://postgis.refractions.net/mailman/listinfo/postgis-users
> >>
> >>
> >
> >
> > _______________________________________________
> > postgis-users mailing list
> > postgis-users@postgis.refractions.net
> > http://postgis.refractions.net/mailman/listinfo/postgis-users
> >
> _______________________________________________
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>

[Attachment #5 (text/html)]

I tried something like the following without removing the same points ad it seems to \
work:<br><br>SELECT st_astext(ST_ConvexHull(ST_GeomFromText(&#39;MULTIPOINT(593901 \
5219610 814,593901 5219610 814,593899 5219610 814,593899 5219610 814,593901 5219610 \
814)&#39;))); <br> &quot;LINESTRING Z (593901 5219610 814,593899 5219610 \
814)&quot;<br><br>Ed<br><br><div class="gmail_quote">On Mon, Oct 29, 2012 at 5:23 PM, \
Nicolas Ribot <span dir="ltr">&lt;<a href="mailto:nicolas.ribot@gmail.com" \
target="_blank">nicolas.ribot@gmail.com</a>&gt;</span> wrote:<br> <blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">You should filter out the consecutive points. If there are \
more than 2<br> points, you can then call st_convexHull() on the point set:<br>
<br>
with points as (<br>
        select &#39;POINT (0 0)&#39;::geometry as geom<br>
        UNION<br>
        select &#39;POINT (1 0)&#39;::geometry as geom<br>
        UNION<br>
        select &#39;POINT (1 1)&#39;::geometry as geom<br>
) select st_convexHull(st_collect(geom))<br>
from points;<br>
<br>
If the points are aligned, convexHull will be a linestring, that you<br>
can discard or further process according to your needs.<br>
<span class="HOEnZb"><font color="#888888"><br>
Nicolas<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On 29 October 2012 16:51, Ed Linde &lt;<a \
href="mailto:edolinde@gmail.com">edolinde@gmail.com</a>&gt; wrote:<br> &gt; Hi \
Nicolas,<br> &gt; It seems like sometimes the points are one and the same and I \
get<br> &gt; linestrings and not<br>
&gt; actual polygons. I pass these points in from a perl script, so is there a<br>
&gt; way I can just<br>
&gt; give the raw x,y,z coordinates of these points and do a st_convexhull<br>
&gt; function on them?<br>
&gt; Could you please give me a small example?<br>
&gt;<br>
&gt; I tried something like:<br>
&gt; The two coordinates marked in red and marked in orange are the same.<br>
&gt;<br>
&gt; bounds=# insert into vfaces values (1,<br>
&gt; bounds(# ST_GeomFromText(&#39;POLYGON((593901 5219610 814,593901 5219610<br>
&gt; 814,593899 5219610 814,593899 5219610 814,593901 5219610 814))&#39;) );<br>
&gt; INSERT 0 1<br>
&gt; bounds=# select st_isvalid(geomtext) from vfaces;<br>
&gt; NOTICE:  Too few points in geometry component at or near point 593901<br>
&gt; 5219610 814<br>
&gt;<br>
&gt;  st_isvalid<br>
&gt; ------------<br>
&gt;  f<br>
&gt; (1 row)<br>
&gt;<br>
&gt; Thanks,<br>
&gt; Ed<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On Mon, Oct 29, 2012 at 4:26 PM, Ed Linde &lt;<a \
href="mailto:edolinde@gmail.com">edolinde@gmail.com</a>&gt; wrote:<br> &gt;&gt;<br>
&gt;&gt; Ok thanks, will look into that function. Because I wonder if the s/w I \
am<br> &gt;&gt; using is<br>
&gt;&gt; actually outputting the vertices of each face in a cyclical fashion or<br>
&gt;&gt; just<br>
&gt;&gt; arbitrarily.<br>
&gt;&gt;<br>
&gt;&gt; Cheers,<br>
&gt;&gt; Ed<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; On Mon, Oct 29, 2012 at 4:23 PM, Nicolas Ribot &lt;<a \
href="mailto:nicolas.ribot@gmail.com">nicolas.ribot@gmail.com</a>&gt;<br> &gt;&gt; \
wrote:<br> &gt;&gt;&gt;<br>
&gt;&gt;&gt; Yes, it looks like some points were not put in the right order \
before<br> &gt;&gt;&gt; building a polygon, thus these &quot;butterfly&quot; polygons \
you generated.<br> &gt;&gt;&gt; If the formed polygon are expected to be convex, you \
could use<br> &gt;&gt;&gt; st_convexhull on the point cloud to generate the \
polygons.<br> &gt;&gt;&gt;<br>
&gt;&gt;&gt; On 29 October 2012 16:09, Ed Linde &lt;<a \
href="mailto:edolinde@gmail.com">edolinde@gmail.com</a>&gt; wrote:<br> &gt;&gt;&gt; \
&gt; Thanks Nicolas! Will look at the script that generated the polygon<br> \
&gt;&gt;&gt; &gt; text..<br> &gt;&gt;&gt; &gt; must have goofed something up \
there.<br> &gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; On Mon, Oct 29, 2012 at 4:05 PM, Nicolas Ribot<br>
&gt;&gt;&gt; &gt; &lt;<a \
href="mailto:nicolas.ribot@gmail.com">nicolas.ribot@gmail.com</a>&gt;<br> \
&gt;&gt;&gt; &gt; wrote:<br> &gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; Hi,<br>
&gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; No. this is because some of your polygons are not valid:<br>
&gt;&gt;&gt; &gt;&gt; for instance:<br>
&gt;&gt;&gt; &gt;&gt; select st_isvalid(&#39;POLYGON  ((593921 5219610 803,593921 \
5219610<br> &gt;&gt;&gt; &gt;&gt; 818,593921 5219620 818,593921 5219620 803,593921 \
5219610<br> &gt;&gt;&gt; &gt;&gt; 803))&#39;::geometry);<br>
&gt;&gt;&gt; &gt;&gt; NOTICE:  Too few points in geometry component at or near point \
593921<br> &gt;&gt;&gt; &gt;&gt; 5219610 803<br>
&gt;&gt;&gt; &gt;&gt;  st_isvalid<br>
&gt;&gt;&gt; &gt;&gt; ------------<br>
&gt;&gt;&gt; &gt;&gt;  f<br>
&gt;&gt;&gt; &gt;&gt; (1 row)<br>
&gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; you can control this with st_isvalid, st_isvalidReason and \
correct<br> &gt;&gt;&gt; &gt;&gt; them with st_makeValid.<br>
&gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; Use only valid objects before processing them with Postgis \
functions.<br> &gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; Nicolas<br>
&gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; On 29 October 2012 16:03, Ed Linde &lt;<a \
href="mailto:edolinde@gmail.com">edolinde@gmail.com</a>&gt; wrote:<br> &gt;&gt;&gt; \
&gt;&gt; &gt; Thanks Nicolas. Just about the error, is this because the line<br> \
&gt;&gt;&gt; &gt;&gt; &gt; segments<br> &gt;&gt;&gt; &gt;&gt; &gt; are<br>
&gt;&gt;&gt; &gt;&gt; &gt; too close<br>
&gt;&gt;&gt; &gt;&gt; &gt; and postgis 2.0 could not handle this? If so is there a \
workaround,<br> &gt;&gt;&gt; &gt;&gt; &gt; even<br>
&gt;&gt;&gt; &gt;&gt; &gt; if<br>
&gt;&gt;&gt; &gt;&gt; &gt; it means<br>
&gt;&gt;&gt; &gt;&gt; &gt; slightly having to &quot;perturb&quot; each point&#39;s \
position to not run into<br> &gt;&gt;&gt; &gt;&gt; &gt; this<br>
&gt;&gt;&gt; &gt;&gt; &gt; bug.<br>
&gt;&gt;&gt; &gt;&gt; &gt; I was really hoping that the intersection of two polygonal \
shapes in<br> &gt;&gt;&gt; &gt;&gt; &gt; 3D<br>
&gt;&gt;&gt; &gt;&gt; &gt; would be fairly<br>
&gt;&gt;&gt; &gt;&gt; &gt; simple in postgis 2.0 :(<br>
&gt;&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt; Ed<br>
&gt;&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt; On Mon, Oct 29, 2012 at 4:00 PM, Nicolas Ribot<br>
&gt;&gt;&gt; &gt;&gt; &gt; &lt;<a \
href="mailto:nicolas.ribot@gmail.com">nicolas.ribot@gmail.com</a>&gt;<br> \
&gt;&gt;&gt; &gt;&gt; &gt; wrote:<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; If the points are computed in the right order, you can \
store them<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; and<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; pass them to st_makeLine and st_makePolygon.<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; If not, you can form a segment between 2 closest \
points and connect<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; it<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; to the closest points.<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; On 29 October 2012 15:37, Ed Linde &lt;<a \
href="mailto:edolinde@gmail.com">edolinde@gmail.com</a>&gt; wrote:<br> &gt;&gt;&gt; \
&gt;&gt; &gt;&gt; &gt; Hi All,<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; Thanks for the \
tips! Just another thing, when I compute the<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; \
&quot;transition<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; points&quot; on each edge \
(shown as red points in my pdf).<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; I need to \
join them to make a polygon. Wondering how I can<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; \
&gt; connect<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; them<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; together so that I start with a point and end on \
it<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; to form a closed polygon?<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; Cheers,<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; Ed<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; On Mon, Oct 29, 2012 at 3:03 PM, Stephen \
Woodbridge<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; &lt;<a \
href="mailto:woodbri@swoodbridge.com">woodbri@swoodbridge.com</a>&gt; wrote:<br> \
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; \
Hi Ed,<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; Well if clarifies one thing at least, you can \
ignore Mike&#39;s<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; st_Relate<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; because 5 is not adjacent to a linear edge, \
it is only adjacent<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; to a<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; vertex,<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; so st_touches should work fine.<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; so you are looking for:<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; 1. a specific triangle by id<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; 2. that intersects triangle VC<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; 3. and the triangles adjacent to triangle by \
id<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; 4. and those that are contained in \
VC<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; 5. sorted by distance to P1 limit \
1<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; so something like:<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; select id, the_geom<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;   from (select id, the_geom as adjacent<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;           from triangles<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;          where st_touches(the_geom,<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;                           (select \
the_geom<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;                              \
from triangles a,<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;                         \
(select the_geom as vc<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;                    \
from vc_table<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;                             \
where id=&#39;p1&#39;) b<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;                  \
where <a href="http://a.id" target="_blank">a.id</a>=4)) c<br> &gt;&gt;&gt; &gt;&gt; \
&gt;&gt; &gt;&gt;  order by st_distance(c.the_geom, (select the_geom<br> &gt;&gt;&gt; \
&gt;&gt; &gt;&gt; &gt;&gt;                                      from points<br> \
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;                                     where \
id=&#39;p1&#39;)) asc limit 1;<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; Untested, but should give you a model to work \
with.<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; -Steve W<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; On 10/29/2012 6:57 AM, Ed Linde wrote:<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; Attached is a figure. Where the dotted \
line is the boundary of<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; the<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; voronoi cell whose<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; generator is point P1. So triangle \
&quot;4&quot; intersects with the<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; \
voronoi<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; boundary, but we are<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; interested in the adjacent triangles of \
triangle 4, which are<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; closer<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; to<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; point P1.<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; For example, triangle 5.<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; Hope this helps.<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; Cheers,<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; Ed<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; On Mon, Oct 29, 2012 at 11:50 AM, Nicolas \
Ribot<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; &lt;<a \
href="mailto:nicolas.ribot@gmail.com">nicolas.ribot@gmail.com</a><br> &gt;&gt;&gt; \
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &lt;mailto:<a \
href="mailto:nicolas.ribot@gmail.com">nicolas.ribot@gmail.com</a>&gt;&gt; wrote:<br> \
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; \
&gt;&gt;&gt;     Could you draw a figure ?<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; \
&gt;&gt;&gt;<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;     Nicolas<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;     On 29 October 2012 11:03, Ed Linde \
&lt;<a href="mailto:edolinde@gmail.com">edolinde@gmail.com</a><br> &gt;&gt;&gt; \
&gt;&gt; &gt;&gt; &gt;&gt;&gt;     &lt;mailto:<a \
href="mailto:edolinde@gmail.com">edolinde@gmail.com</a>&gt;&gt; wrote:<br> \
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt; Hi All,<br> &gt;&gt;&gt; \
&gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt; Thanks for the suggestions.<br> &gt;&gt;&gt; \
&gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt; For 1) I will look into how ST_touches works \
and see if<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; it<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; can<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;     pick up all<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt; the adjacent polygons to<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt; the one I have. And also look \
into Mike&#39;s suggestion on<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;     \
ST_relate...though I<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt; must \
admit it looks<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt; more \
complex.<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt; For 2) I will try \
to clarify it a bit more... its harder<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; \
&gt;&gt;&gt; to<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; do<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;     without a<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt; figure :) but here goes.<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt; Lets say we have a point Q \
which is the generator of a<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; \
voronoi<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;     cell. Now I<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt; compute the<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt; intersection between the \
voronoi cell boundaries and my<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;     \
triangulation (Set<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt; of \
polygons)<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt; using \
ST_intersect. Once I have these triangles.. I say<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; \
&gt;&gt;&gt; pick<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; one<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;     triangle T<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt; that is<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt; intersecting the voronoi cell \
boundary of Q.<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt; For all the \
triangles adjacent to T, I need to know<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; \
&gt;&gt;&gt; which<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;     triangles \
are<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt; INSIDE the voronoi<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt; boundary (closer to Q) and \
which adjacent triangles are<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; just<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;     OUTSIDE the<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt; voronoi<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt; boundary (farther from Q). I am \
basically testing for a<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; certain<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;     property by<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt; &quot;shrinking&quot; the<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt; voronoi cell (closer to Q) and \
another property when<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; \
&quot;expanding&quot;<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;     the \
voronoi<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt; cell (away from \
Q).<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt; Just need to make this \
division of triangles. Haven&#39;t<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; \
thought<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; of<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;     a nice way<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt; to do this in postgis 2.0<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt; So any suggestions would \
greatly help.<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt; Thanks,<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt; Ed<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt; On Mon, Oct 29, 2012 at 10:15 \
AM, Mike Toews<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; &lt;<a \
href="mailto:mwtoews@gmail.com">mwtoews@gmail.com</a><br> &gt;&gt;&gt; &gt;&gt; \
&gt;&gt; &gt;&gt;&gt;     &lt;mailto:<a \
href="mailto:mwtoews@gmail.com">mwtoews@gmail.com</a>&gt;&gt; wrote:<br> &gt;&gt;&gt; \
&gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt;&gt;<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; \
&gt;&gt;&gt;      &gt;&gt; On 29 October 2012 21:33, Ed Linde &lt;<a \
href="mailto:edolinde@gmail.com">edolinde@gmail.com</a><br> &gt;&gt;&gt; &gt;&gt; \
&gt;&gt; &gt;&gt;&gt;     &lt;mailto:<a \
href="mailto:edolinde@gmail.com">edolinde@gmail.com</a>&gt;&gt; wrote:<br> \
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt;&gt; &gt; Hi All,<br> \
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt;&gt; &gt; I need help with 2 \
hard problems. I store triangles<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; in \
a<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; table<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; as<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt;&gt; &gt; POLYGON.<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt;&gt; &gt; 1. I want to know for \
a given triangle, which<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; triangles<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; share<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;     an edge<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt;&gt; &gt; (adjacent) with this \
triangle.<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt;&gt; Sounds like you have a \
finite element mesh with nodes<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; \
and<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; elements.<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt;&gt; You can use ST_Relate with \
pattern &#39;FF2F11212&#39; to pick<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; \
out<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; elements<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt;&gt; that share the same edge. \
This DE-9-IM is sort-of a<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; custom<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;     ST_Touches,<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt;&gt; but only takes linear \
boundary overlaps. So if you have<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; \
a<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; table<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt;&gt; &quot;elements&quot;, and \
you want to find ones that touch ID<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; \
567:<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt;&gt; SELECT elements.*<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt;&gt; FROM elements, elements as \
e<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt;&gt; WHERE <a \
href="http://e.id" target="_blank">e.id</a> &lt;<a href="http://e.id" \
target="_blank">http://e.id</a>&gt; = 567 AND<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; \
&gt;&gt;&gt;<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt;&gt;     \
ST_Relate(elements.geom, e.geom, &#39;FF2F11212&#39;);<br> &gt;&gt;&gt; &gt;&gt; \
&gt;&gt; &gt;&gt;&gt;      &gt;&gt;<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;   \
&gt;&gt; I&#39;m not certain about your second question.<br> &gt;&gt;&gt; &gt;&gt; \
&gt;&gt; &gt;&gt;&gt;      &gt;&gt;<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;   \
&gt;&gt; -Mike<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt;&gt; \
_______________________________________________<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; \
&gt;&gt;&gt;      &gt;&gt; postgis-users mailing list<br> &gt;&gt;&gt; &gt;&gt; \
&gt;&gt; &gt;&gt;&gt;      &gt;&gt; <a \
href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
 &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;     &lt;mailto:<a \
href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a>&gt;<br>
 &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; <a \
href="http://postgis.refractions.net/mailman/listinfo/postgis-users" \
target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br> \
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt;<br> &gt;&gt;&gt; &gt;&gt; \
&gt;&gt; &gt;&gt;&gt;      &gt;<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      \
&gt;<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt; \
_______________________________________________<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; \
&gt;&gt;&gt;      &gt; postgis-users mailing list<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; \
&gt;&gt;&gt;      &gt; <a \
href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
 &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;     &lt;mailto:<a \
href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a>&gt;<br>
 &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; <a \
href="http://postgis.refractions.net/mailman/listinfo/postgis-users" \
target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br> \
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;      &gt;<br> &gt;&gt;&gt; &gt;&gt; \
&gt;&gt; &gt;&gt;&gt;     _______________________________________________<br> \
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;     postgis-users mailing list<br> \
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;     <a \
href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
 &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;     &lt;mailto:<a \
href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a>&gt;<br>
 &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; <a \
href="http://postgis.refractions.net/mailman/listinfo/postgis-users" \
target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br> \
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; \
&gt;&gt;&gt;<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; \
_______________________________________________<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; \
&gt;&gt;&gt; postgis-users mailing list<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; \
&gt;&gt;&gt; <a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
 &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; <a \
href="http://postgis.refractions.net/mailman/listinfo/postgis-users" \
target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br> \
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; \
&gt;&gt;<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; \
_______________________________________________<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; \
&gt;&gt; postgis-users mailing list<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; <a \
href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
 &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; <a \
href="http://postgis.refractions.net/mailman/listinfo/postgis-users" \
target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br> \
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; \
_______________________________________________<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; \
&gt; postgis-users mailing list<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; <a \
href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
 &gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; <a \
href="http://postgis.refractions.net/mailman/listinfo/postgis-users" \
target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br> \
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; \
_______________________________________________<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; \
postgis-users mailing list<br> &gt;&gt;&gt; &gt;&gt; &gt;&gt; <a \
href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
 &gt;&gt;&gt; &gt;&gt; &gt;&gt; <a \
href="http://postgis.refractions.net/mailman/listinfo/postgis-users" \
target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br> \
&gt;&gt;&gt; &gt;&gt; &gt;<br> &gt;&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt; _______________________________________________<br>
&gt;&gt;&gt; &gt;&gt; &gt; postgis-users mailing list<br>
&gt;&gt;&gt; &gt;&gt; &gt; <a \
href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
 &gt;&gt;&gt; &gt;&gt; &gt; <a \
href="http://postgis.refractions.net/mailman/listinfo/postgis-users" \
target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br> \
&gt;&gt;&gt; &gt;&gt; &gt;<br> &gt;&gt;&gt; &gt;&gt; \
_______________________________________________<br> &gt;&gt;&gt; &gt;&gt; \
postgis-users mailing list<br> &gt;&gt;&gt; &gt;&gt; <a \
href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
 &gt;&gt;&gt; &gt;&gt; <a \
href="http://postgis.refractions.net/mailman/listinfo/postgis-users" \
target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br> \
&gt;&gt;&gt; &gt;<br> &gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; _______________________________________________<br>
&gt;&gt;&gt; &gt; postgis-users mailing list<br>
&gt;&gt;&gt; &gt; <a \
href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
 &gt;&gt;&gt; &gt; <a \
href="http://postgis.refractions.net/mailman/listinfo/postgis-users" \
target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br> \
&gt;&gt;&gt; &gt;<br> &gt;&gt;&gt; \
_______________________________________________<br> &gt;&gt;&gt; postgis-users \
mailing list<br> &gt;&gt;&gt; <a \
href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
 &gt;&gt;&gt; <a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" \
target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br> \
&gt;&gt;<br> &gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; postgis-users mailing list<br>
&gt; <a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
 &gt; <a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" \
target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br> \
&gt;<br> _______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
 <a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" \
target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br> \
</div></div></blockquote></div><br>



_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic