PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwgeom_normalize()

LWGEOM* lwgeom_normalize ( const LWGEOM geom)

Definition at line 561 of file liblwgeom/lwgeom_geos.c.

References LWGEOM::flags, FLAGS_GET_Z, GEOS2LWGEOM(), lwerror(), LWGEOM2GEOS(), lwgeom_geos_errmsg, lwgeom_geos_error(), lwnotice(), and LWGEOM::srid.

Referenced by ST_Normalize(), and test_lwgeom_delaunay_triangulation().

562 {
563  LWGEOM *result ;
564  GEOSGeometry *g1;
565  int is3d ;
566  int srid ;
567 
568  srid = (int)(geom1->srid);
569  is3d = FLAGS_GET_Z(geom1->flags);
570 
571  initGEOS(lwnotice, lwgeom_geos_error);
572 
573  g1 = LWGEOM2GEOS(geom1, 0);
574  if ( 0 == g1 ) /* exception thrown at construction */
575  {
576  lwerror("First argument geometry could not be converted to GEOS: %s", lwgeom_geos_errmsg);
577  return NULL ;
578  }
579 
580  if ( -1 == GEOSNormalize(g1) )
581  {
582  lwerror("Error in GEOSNormalize: %s", lwgeom_geos_errmsg);
583  return NULL; /* never get here */
584  }
585 
586  GEOSSetSRID(g1, srid); /* needed ? */
587  result = GEOS2LWGEOM(g1, is3d);
588  GEOSGeom_destroy(g1);
589 
590  if (result == NULL)
591  {
592  lwerror("Error performing intersection: GEOS2LWGEOM: %s", lwgeom_geos_errmsg);
593  return NULL ; /* never get here */
594  }
595 
596  return result ;
597 }
void lwnotice(const char *fmt,...)
Write a notice out to the notice handler.
Definition: lwutil.c:177
char lwgeom_geos_errmsg[LWGEOM_GEOS_ERRMSG_MAXSIZE]
void lwgeom_geos_error(const char *fmt,...)
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:140
GEOSGeometry * LWGEOM2GEOS(const LWGEOM *lwgeom, int autofix)
LWGEOM * GEOS2LWGEOM(const GEOSGeometry *geom, char want3d)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
Here is the call graph for this function:
Here is the caller graph for this function: