[postgis-users] How to get the centroid of an bounding box using st_extent
Charlie Savage
cfis at savagexi.com
Fri Sep 21 13:25:54 PDT 2007
Hi Paul et al,
> Well, clearly there's a bug to be fixed.
And attached is a patch. This updates BOX2DFLOAT4_to_LWGEOM and
BOX3D_to_LWGEOM to:
* Return a point when xmin==xmax && ymin==ymax
* Return a line string when xmin==xmax || ymin==ymax
* Otherwise return a polygon
Note both methods are exactly the same, except the first line - which
does seem pretty silly. I'd probably change BOX3D_to_LWGEOM to create a
box2dfloat and then call BOX2DFLOAT4_to_LWGEOM. But I left it as it
was. I also cleaned up the code a bit to use pointArray_construct -
which for some reason it wasn't.
Thanks,
Charlie
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: postgis_box_to_geom.patch
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20070921/1a9af148/attachment.ksh>
-------------- 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-users/attachments/20070921/1a9af148/attachment.bin>
More information about the postgis-users
mailing list