PostGIS  2.5.0dev-r@@SVN_REVISION@@
LWGEOM* lwgeom_normalize ( const LWGEOM geom1)

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

556 {
557  LWGEOM *result ;
558  GEOSGeometry *g1;
559  int is3d ;
560  int srid ;
561 
562  srid = (int)(geom1->srid);
563  is3d = FLAGS_GET_Z(geom1->flags);
564 
565  initGEOS(lwnotice, lwgeom_geos_error);
566 
567  g1 = LWGEOM2GEOS(geom1, 0);
568  if ( 0 == g1 ) /* exception thrown at construction */
569  {
570  lwerror("First argument geometry could not be converted to GEOS: %s", lwgeom_geos_errmsg);
571  return NULL ;
572  }
573 
574  if ( -1 == GEOSNormalize(g1) )
575  {
576  lwerror("Error in GEOSNormalize: %s", lwgeom_geos_errmsg);
577  return NULL; /* never get here */
578  }
579 
580  GEOSSetSRID(g1, srid); /* needed ? */
581  result = GEOS2LWGEOM(g1, is3d);
582  GEOSGeom_destroy(g1);
583 
584  if (result == NULL)
585  {
586  lwerror("Error performing intersection: GEOS2LWGEOM: %s",
588  return NULL ; /* never get here */
589  }
590 
591  return result ;
592 }
void lwnotice(const char *fmt,...)
Write a notice out to the notice handler.
Definition: lwutil.c:177
uint8_t flags
Definition: liblwgeom.h:396
char lwgeom_geos_errmsg[LWGEOM_GEOS_ERRMSG_MAXSIZE]
int32_t srid
Definition: liblwgeom.h:398
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:190

Here is the call graph for this function:

Here is the caller graph for this function: