PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ lwgeom_normalize()

LWGEOM* lwgeom_normalize ( const LWGEOM geom)

Definition at line 531 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().

532 {
533  LWGEOM *result ;
534  GEOSGeometry *g1;
535  int is3d ;
536  int srid ;
537 
538  srid = (int)(geom1->srid);
539  is3d = FLAGS_GET_Z(geom1->flags);
540 
541  initGEOS(lwnotice, lwgeom_geos_error);
542 
543  g1 = LWGEOM2GEOS(geom1, 0);
544  if ( 0 == g1 ) /* exception thrown at construction */
545  {
546  lwerror("First argument geometry could not be converted to GEOS: %s", lwgeom_geos_errmsg);
547  return NULL ;
548  }
549 
550  if ( -1 == GEOSNormalize(g1) )
551  {
552  lwerror("Error in GEOSNormalize: %s", lwgeom_geos_errmsg);
553  return NULL; /* never get here */
554  }
555 
556  GEOSSetSRID(g1, srid); /* needed ? */
557  result = GEOS2LWGEOM(g1, is3d);
558  GEOSGeom_destroy(g1);
559 
560  if (result == NULL)
561  {
562  lwerror("Error performing intersection: GEOS2LWGEOM: %s",
564  return NULL ; /* never get here */
565  }
566 
567  return result ;
568 }
void lwnotice(const char *fmt,...)
Write a notice out to the notice handler.
Definition: lwutil.c:89
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:139
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:102
Here is the call graph for this function:
Here is the caller graph for this function: