[postgis-devel] Patching Envelope - Advice Needed
Charlie Savage
cfis at savagexi.com
Fri Sep 21 11:46:23 PDT 2007
Ok - I'm back to fixing up Envelope/Extent to return valid geometries -
as we've been discussion the last week on the mailing list.
Since I'm not that familiar with PostGIS I was wondering if someone
could provide advice. Is is okay to return the original geometry - to
should I make a copy. In my last patch I derialized a Point, created a
new one, and returned it. But would returning the geometry directly be
ok? Like this:
PG_FUNCTION_INFO_V1(LWGEOM_envelope);
Datum LWGEOM_envelope(PG_FUNCTION_ARGS)
{
PG_LWGEOM *geom = (PG_LWGEOM *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
BOX2DFLOAT4 box;
POINT2D *pts = lwalloc(sizeof(POINT2D)*5);
POINTARRAY *pa[1];
LWPOLY *poly;
int SRID;
PG_LWGEOM *result;
uchar *ser;
SRID = lwgeom_getsrid(SERIALIZED_FORM(geom));
if (lwgeom_getType(geom->type) == POINTTYPE ||
lwgeom_getType(geom->type) == LINETYPE)
{
PG_RETURN_POINTER(geom);
}
Or will that cause all sorts of havoc?
Charlie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20070921/cd983ede/attachment.bin>
More information about the postgis-devel
mailing list