814{
816 GEOSGeometry *g1, *g3;
819 int32_t srid;
821
822 geom1 = PG_GETARG_GSERIALIZED_P(0);
823
824
826 PG_RETURN_POINTER(geom1);
827
829
831
833
834 if (!g1)
836
837 g3 = GEOSConvexHull(g1);
838 GEOSGeom_destroy(g1);
839
841
842 POSTGIS_DEBUGF(3, "result: %s", GEOSGeomToWKT(g3));
843
844 GEOSSetSRID(g3, srid);
845
847 GEOSGeom_destroy(g3);
848
849 if (!lwout)
850 {
851 elog(ERROR,
852 "convexhull() failed to convert GEOS geometry to LWGEOM");
853 PG_RETURN_NULL();
854 }
855
856
858 {
859
862 }
863
864 result = geometry_serialize(lwout);
866
868 {
869 elog(ERROR,"GEOS convexhull() threw an error (result postgis geometry formation)!");
870 PG_RETURN_NULL();
871 }
872
873 PG_FREE_IF_COPY(geom1, 0);
874 PG_RETURN_POINTER(
result);
875}
char result[OUT_DOUBLE_BUFFER_SIZE]
GBOX * gbox_copy(const GBOX *box)
Return a copy of the GBOX, based on dimensionality of flags.
int32_t gserialized_get_srid(const GSERIALIZED *g)
Extract the SRID from the serialized form (it is packed into three bytes so this is a handy function)...
int gserialized_get_gbox_p(const GSERIALIZED *g, GBOX *gbox)
Read the box from the GSERIALIZED or calculate it if necessary.
int gserialized_is_empty(const GSERIALIZED *g)
Check if a GSERIALIZED is empty without deserializing first.
int gserialized_has_z(const GSERIALIZED *g)
Check if a GSERIALIZED has a Z ordinate.
void lwgeom_geos_error(const char *fmt,...)
void(*) LWGEOM GEOS2LWGEOM)(const GEOSGeometry *geom, uint8_t want3d)
void lwgeom_free(LWGEOM *geom)
GEOSGeometry * POSTGIS2GEOS(const GSERIALIZED *pglwgeom)
#define HANDLE_GEOS_ERROR(label)