696{
698 GEOSGeometry *g1, *g3;
701 int32_t srid;
702
703 geom1 = PG_GETARG_GSERIALIZED_P(0);
704
705
707 PG_RETURN_POINTER(geom1);
708
710
712 if ( ! lwgeom ) {
713 lwpgerror("POSTGIS2GEOS: unable to deserialize input");
714 PG_RETURN_NULL();
715 }
716
717
719 {
723 PG_RETURN_POINTER(result);
724 }
725
727
730
731 if (!g1)
733
734 g3 = GEOSBoundary(g1);
735
736 if (!g3)
737 {
738 GEOSGeom_destroy(g1);
740 }
741
742 POSTGIS_DEBUGF(3, "result: %s", GEOSGeomToWKT(g3));
743
744 GEOSSetSRID(g3, srid);
745
747
748 if (!result)
749 {
750 GEOSGeom_destroy(g1);
751 GEOSGeom_destroy(g3);
752 elog(NOTICE,
753 "GEOS2POSTGIS threw an error (result postgis geometry "
754 "formation)!");
755 PG_RETURN_NULL();
756 }
757
758 GEOSGeom_destroy(g1);
759 GEOSGeom_destroy(g3);
760
761 PG_FREE_IF_COPY(geom1, 0);
762
763 PG_RETURN_POINTER(result);
764}
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)...
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
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.
GEOSGeometry * LWGEOM2GEOS(const LWGEOM *lwgeom, uint8_t autofix)
void lwgeom_geos_error(const char *fmt,...)
void lwgeom_free(LWGEOM *geom)
GSERIALIZED * GEOS2POSTGIS(GEOSGeom geom, char want3d)
#define HANDLE_GEOS_ERROR(label)
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)