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

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

506 {
507  LWGEOM *result ;
508  GEOSGeometry *g1;
509  int is3d ;
510  int srid ;
511 
512  srid = (int)(geom1->srid);
513  is3d = FLAGS_GET_Z(geom1->flags);
514 
515  initGEOS(lwnotice, lwgeom_geos_error);
516 
517  g1 = LWGEOM2GEOS(geom1, 0);
518  if ( 0 == g1 ) /* exception thrown at construction */
519  {
520  lwerror("First argument geometry could not be converted to GEOS: %s", lwgeom_geos_errmsg);
521  return NULL ;
522  }
523 
524  if ( -1 == GEOSNormalize(g1) )
525  {
526  lwerror("Error in GEOSNormalize: %s", lwgeom_geos_errmsg);
527  return NULL; /* never get here */
528  }
529 
530  GEOSSetSRID(g1, srid); /* needed ? */
531  result = GEOS2LWGEOM(g1, is3d);
532  GEOSGeom_destroy(g1);
533 
534  if (result == NULL)
535  {
536  lwerror("Error performing intersection: GEOS2LWGEOM: %s",
538  return NULL ; /* never get here */
539  }
540 
541  return result ;
542 }
void lwnotice(const char *fmt,...)
Write a notice out to the notice handler.
Definition: lwutil.c:61
uint8_t flags
Definition: liblwgeom.h:381
char lwgeom_geos_errmsg[LWGEOM_GEOS_ERRMSG_MAXSIZE]
int32_t srid
Definition: liblwgeom.h:383
void lwgeom_geos_error(const char *fmt,...)
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:124
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:74

Here is the call graph for this function:

Here is the caller graph for this function: