PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ lwgeom_extract_unique_endpoints()

static LWGEOM* lwgeom_extract_unique_endpoints ( const LWGEOM lwg)
static

Definition at line 99 of file lwgeom_geos_node.c.

100 {
101  LWGEOM* ret;
102  GEOSGeometry *gepu;
103  LWMPOINT *epall = lwgeom_extract_endpoints(lwg);
104  GEOSGeometry *gepall = LWGEOM2GEOS((LWGEOM*)epall, 1);
105  lwmpoint_free(epall);
106  if ( ! gepall ) {
107  lwerror("LWGEOM2GEOS: %s", lwgeom_geos_errmsg);
108  return NULL;
109  }
110 
111  /* UnaryUnion to remove duplicates */
112  /* TODO: do it all within pgis using indices */
113  gepu = GEOSUnaryUnion(gepall);
114  if ( ! gepu ) {
115  GEOSGeom_destroy(gepall);
116  lwerror("GEOSUnaryUnion: %s", lwgeom_geos_errmsg);
117  return NULL;
118  }
119  GEOSGeom_destroy(gepall);
120 
121  ret = GEOS2LWGEOM(gepu, FLAGS_GET_Z(lwg->flags));
122  GEOSGeom_destroy(gepu);
123  if ( ! ret ) {
124  lwerror("Error during GEOS2LWGEOM");
125  return NULL;
126  }
127 
128  return ret;
129 }
char lwgeom_geos_errmsg[LWGEOM_GEOS_ERRMSG_MAXSIZE]
GEOSGeometry * LWGEOM2GEOS(const LWGEOM *lwgeom, uint8_t autofix)
void(*) LWGEOM GEOS2LWGEOM)(const GEOSGeometry *geom, uint8_t want3d)
void lwmpoint_free(LWMPOINT *mpt)
Definition: lwmpoint.c:72
#define FLAGS_GET_Z(flags)
Definition: liblwgeom.h:165
static LWMPOINT * lwgeom_extract_endpoints(const LWGEOM *lwg)
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
lwflags_t flags
Definition: liblwgeom.h:461

References LWGEOM::flags, FLAGS_GET_Z, lwerror(), LWGEOM2GEOS(), lwgeom_extract_endpoints(), lwgeom_geos_errmsg, and lwmpoint_free().

Referenced by lwgeom_node().

Here is the call graph for this function:
Here is the caller graph for this function: