<HTML dir=ltr><HEAD>
<META http-equiv=Content-Type content="text/html; charset=unicode">
<META content="MSHTML 6.00.2900.3354" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial color=#000000 size=2>I recall we were discussing a need for a split by function and that ST_GeometryN etc. is slow for large geometries. Unfortunately I don't have any humongous geometries to test with.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I just looked at ST_Dump (not sure why I never used it before, I guess because generate_series is more versatile.).  Anyrate it seems to me it comes very close to a split by and with range ability.  </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I presume ST_Dump is much more efficient than ST_GeometryN since it would make only one call out.  Kevin can you test out that old generate_series one you had with dump?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>E.g. I can do this</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><BR>SELECT a.somefield1, a.somefield2, a.geom</DIV>
<DIV>FROM<BR>(SELECT somefield1, somefield2, (ST_Dump(the_geom)).*<BR>FROM sometablewithmulties) as a<BR>WHERE<BR>a.path[1] between 2 and 5;</DIV>
<DIV> </DIV>
<DIV>To grab all geometries in all records in a MULTI between 2 and 5 slot. Granted I can't think of a use for such a thing.</DIV>
<DIV> </DIV>
<DIV>Which allows me to wrap this in an sql function wrapper to generate a </DIV>
<DIV>pgis_GeometryRangeN(start int, end int) </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>or </DIV>
<DIV>pgis_GeometryAll() returns geometry[]</DIV>
<DIV> </DIV>
<DIV>similarly the below denatures a MULTIPOLYGON/LINESTRING to single POLYGON/LINESTRINGS<BR>SELECT a.somefield, (ST_Dump(the_geom)).geom<BR>FROM sometable as a;</DIV>
<DIV> </DIV>
<DIV>Which allows me to wrap this in a simple SQL function that does all sorts of split by stuff.  E.g. for geometry collections I suppose it could get interesting with those multidimensional arrays.  Unfortunately I guess ST_Dump is not going to deal with single geometries and breaking into points etc.  But seems if its efficient for the other case - we can create a similar one to deal with the other cases by cutting and pasting some of the logic.</DIV>
<DIV> </DIV>
<DIV>Thanks,</DIV>
<DIV>Regina</DIV>
<DIV> </DIV>
<DIV><BR> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV></BODY></HTML>
<HTML><BODY><P><hr size=1></P>
<P><STRONG>
The substance of this message, including any attachments, may be confidential, legally privileged and/or exempt from disclosure pursuant to Massachusetts law. It is intended solely for the addressee. If you received this in error, please contact the sender and delete the material from any computer.
</STRONG></P></BODY></HTML>

<P><hr size=1></P>
<P><STRONG><font size="2" color="339900"> Help make the earth a greener place. If at all possible resist printing this email and join us in saving paper. </p> <p> </font></STRONG></P>