[postgis-users] Difficult Problem with Polygons

Ed Linde edolinde at gmail.com
Mon Oct 29 08:03:14 PDT 2012


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 at 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 at 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 at 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 at gmail.com
> >>> <mailto:nicolas.ribot at gmail.com>> wrote:
> >>>
> >>>     Could you draw a figure ?
> >>>
> >>>     Nicolas
> >>>
> >>>     On 29 October 2012 11:03, Ed Linde <edolinde at gmail.com
> >>>     <mailto:edolinde at 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 at gmail.com
> >>>     <mailto:mwtoews at gmail.com>> wrote:
> >>>      >>
> >>>      >> On 29 October 2012 21:33, Ed Linde <edolinde at gmail.com
> >>>     <mailto:edolinde at 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 at postgis.refractions.net
> >>>     <mailto:postgis-users at postgis.refractions.net>
> >>>
> >>>      >> http://postgis.refractions.net/mailman/listinfo/postgis-users
> >>>      >
> >>>      >
> >>>      >
> >>>      > _______________________________________________
> >>>      > postgis-users mailing list
> >>>      > postgis-users at postgis.refractions.net
> >>>     <mailto:postgis-users at postgis.refractions.net>
> >>>
> >>>      > http://postgis.refractions.net/mailman/listinfo/postgis-users
> >>>      >
> >>>     _______________________________________________
> >>>     postgis-users mailing list
> >>>     postgis-users at postgis.refractions.net
> >>>     <mailto:postgis-users at postgis.refractions.net>
> >>>
> >>>     http://postgis.refractions.net/mailman/listinfo/postgis-users
> >>>
> >>>
> >>>
> >>>
> >>> _______________________________________________
> >>> postgis-users mailing list
> >>> postgis-users at postgis.refractions.net
> >>> http://postgis.refractions.net/mailman/listinfo/postgis-users
> >>>
> >>
> >> _______________________________________________
> >> postgis-users mailing list
> >> postgis-users at postgis.refractions.net
> >> http://postgis.refractions.net/mailman/listinfo/postgis-users
> >
> >
> >
> > _______________________________________________
> > postgis-users mailing list
> > postgis-users at postgis.refractions.net
> > http://postgis.refractions.net/mailman/listinfo/postgis-users
> >
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20121029/b545e7ca/attachment.html>


More information about the postgis-users mailing list