[postgis-devel] How do you obtain the line that touches a polygon?

Paul Ramsey pramsey at cleverelephant.ca
Thu May 29 14:58:09 PDT 2008


It's possible your line doesn't quite touch the polygon, so perhaps a
distance filter would be better with a small tolerance.

SELECT ST_AsText(myline.the_geom)
FROM myline,mypoly
WHERE ST_DWithin(myline.the_geom, mypoly.the_geom, 0.001);

P.

On Thu, May 29, 2008 at 2:43 PM, googling1000 <googling1000 at yahoo.com> wrote:
>
> Hi,
> I have one polygon, and a line lies exactly on an edge of that polygon.
> How do I obtain that line?
>
> Please take a look at a picture here:
> http://googling1000.googlepages.com/example.jpg
> (I drew the lines using different thickness so it is easy to understand
> where each segment ended)
> The line segment A is touching the polygon P, and I'd like to write a query
> statement that will fetch me that line.
>
> I tried ST_intersects and ST_Touches, but the queries return 0 rows.
>
> Then, I tried && which is another intersection command?
> This is the query statment:
> select ST_AsText(myline.the_geom) from myline,mypoly where mypoly.the_geom
> && myline.the_geom AND mypoly.polynum = '11'
> Note that 11 is the number associated with polygon P
>
> I was hoping to get only the A segment, but I got all A,B,C segments as a
> result. why is that?
> How do I obtain segment A?
>
> Help will be highly appreciated.
> --
> View this message in context: http://www.nabble.com/How-do-you-obtain-the-line-that-touches-a-polygon--tp17462947p17462947.html
> Sent from the PostGIS - Dev mailing list archive at Nabble.com.
>
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel
>



More information about the postgis-devel mailing list