Hi there<div><br></div><div>I have 2000 polygons in table A and I want to show only the polygons that intersect with the bounding box specified in table B  . So I do this:</div><div><br></div><div><div>    SELECT the_geom </div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>FROM  A</div><div><span class="Apple-tab-span" style="white-space:pre">      </span>WHERE st_intersects(the_geom, (select the_geom from B))</div><div><span class="Apple-tab-span" style="white-space:pre">      </span>AND ST_GeometryType(the_geom) = 'ST_Polygon'</div>
</div><div><br></div><div>This query returns all the intersecting polygons. When I run st_geometrytype they are all St_Polygon.</div><div><br></div><div>Some of the polygons are large and exceed the boxes boundary so I use this query to trim them:</div>
<div><br></div><div><div>    SELECT st_intersection(the_geom, (select the_geom from B)) as the_geom </div><div><span class="Apple-tab-span" style="white-space:pre">        </span>FROM  A</div><div><span class="Apple-tab-span" style="white-space:pre">      </span>WHERE st_intersects(the_geom, (select the_geom from B))</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>AND ST_GeometryType(the_geom) = 'ST_Polygon'</div></div><div><br></div><div><br></div><div>The problem I'm having is that when I use the st_intersection, instead of returning just St_Polygon's, it's returning other types as well:</div>
<div><br></div><div><div>ST_LineString</div><div>ST_MultiLineString</div><div>ST_MultiPolygon</div><div>ST_Polygon</div></div><div><br></div><div>I need to output the results to a SHP file and this is preventing me from doing so seeing there is more than one Geom Type.</div>
<div><br></div><div>Any ideas how I can keep the results of the st_intersection as just St_Polygons? Am I doing something wrong?</div><div><br></div><div>Regards</div><div><br></div><div>Rebecca</div><div><br></div><div><br>
</div><div><br></div><div><br></div>