<div>Hi Thip,</div>
<div> </div>
<div>I recommend filling out your SQL statement much more, and using the 'intersection' within a sub-query.</div>
<div> </div>
<div>Here's an example that uses the 'crosses' test, it returns the features of a polygon table that cross the features of a line table. For my website, it is the data source of a layer that shows forest fire polygons that cross a pipeline, tested on the fly - requiring no pre-processing when new forest fires are added to the dataset.
</div>
<div> </div>
<div>You could modify it for use with 'intersection'. My example checks for an overlap of the bounding boxes of the features before doing the exact 'crosses' test, which speeds up the analysis tremendously. </div>
<div> </div>
<div> DATA "the_geom FROM (SELECT layer1.* FROM layer1, layer2 WHERE layer1.the_geom && layer2.the_geom AND CROSSES(layer1.the_geom, layer2.the_geom) AS foo USING UNIQUE gid USING SRID=26910"<br> </div>
<div>Cheers,<br>Ken Lord</div>
<div>Vancouver BC</div>
<div> </div>
<div><br> </div>
<div><span class="gmail_quote">On 8/31/05, <b class="gmail_sendername">Matthew Perry</b> <<a href="mailto:perrygeo@gmail.com">perrygeo@gmail.com</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Thip,<br><br>
<div><span class="gmail_quote">On 8/31/05, <b class="gmail_sendername">Thip</b> <<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:thip@ait.ac.th" target="_blank">thip@ait.ac.th</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<div>
<p><font size="2">DATA " select intersection (twy_sec.the_geom, twy_su.the_geom) using unique gid using SRID=-1"</font></p><span></span></div></blockquote></div>Check this DATA statement against the example in the postgis docs. You may have to rewrite it a bit.
<br><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="http://postgis.refractions.net/docs/ch04.html#id2512784" target="_blank">http://postgis.refractions.net/docs/ch04.html#id2512784</a>
<div><span class="e" id="q_1060bb1952b32301_1"><br><br>-- <br>Matt Perry<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:perrygeo@gmail.com" target="_blank">perrygeo@gmail.com</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.perrygeo.net/" target="_blank">
http://www.perrygeo.net</a> </span></div></blockquote></div><br>