768{
770 GEOSGeometry *g1, *g3;
773 int32_t srid;
775
776 geom1 = PG_GETARG_GSERIALIZED_P(0);
777
778
780 PG_RETURN_POINTER(geom1);
781
783
785
787
788 if (!g1)
790
791 g3 = GEOSConvexHull(g1);
792 GEOSGeom_destroy(g1);
793
795
796 POSTGIS_DEBUGF(3, "result: %s", GEOSGeomToWKT(g3));
797
798 GEOSSetSRID(g3, srid);
799
801 GEOSGeom_destroy(g3);
802
803 if (!lwout)
804 {
805 elog(ERROR,
806 "convexhull() failed to convert GEOS geometry to LWGEOM");
807 PG_RETURN_NULL();
808 }
809
810
812 {
813
816 }
817
820
821 if (!result)
822 {
823 elog(ERROR,"GEOS convexhull() threw an error (result postgis geometry formation)!");
824 PG_RETURN_NULL();
825 }
826
827 PG_FREE_IF_COPY(geom1, 0);
828 PG_RETURN_POINTER(result);
829}
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.
LWGEOM * GEOS2LWGEOM(const GEOSGeometry *geom, uint8_t want3d)
void lwgeom_geos_error(const char *fmt,...)
void lwgeom_free(LWGEOM *geom)
#define HANDLE_GEOS_ERROR(label)
GEOSGeometry * POSTGIS2GEOS(GSERIALIZED *pglwgeom)
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)