PostGIS  2.1.10dev-r@@SVN_REVISION@@
LWGEOM* lwgeom_normalize ( const LWGEOM geom)

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

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

Referenced by test_lwgeom_delaunay_triangulation().

438 {
439  LWGEOM *result ;
440  GEOSGeometry *g1;
441  int is3d ;
442  int srid ;
443 
444  srid = (int)(geom1->srid);
445  is3d = FLAGS_GET_Z(geom1->flags);
446 
447  initGEOS(lwnotice, lwgeom_geos_error);
448 
449  g1 = LWGEOM2GEOS(geom1);
450  if ( 0 == g1 ) /* exception thrown at construction */
451  {
452  lwerror("First argument geometry could not be converted to GEOS: %s", lwgeom_geos_errmsg);
453  return NULL ;
454  }
455 
456  if ( -1 == GEOSNormalize(g1) )
457  {
458  lwerror("Error in GEOSNormalize: %s", lwgeom_geos_errmsg);
459  return NULL; /* never get here */
460  }
461 
462  GEOSSetSRID(g1, srid); /* needed ? */
463  result = GEOS2LWGEOM(g1, is3d);
464  GEOSGeom_destroy(g1);
465 
466  if (result == NULL)
467  {
468  lwerror("Error performing intersection: GEOS2LWGEOM: %s",
470  return NULL ; /* never get here */
471  }
472 
473  return result ;
474 }
char lwgeom_geos_errmsg[LWGEOM_GEOS_ERRMSG_MAXSIZE]
GEOSGeometry * LWGEOM2GEOS(const LWGEOM *lwgeom)
char ** result
Definition: liblwgeom.h:218
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:67
void lwnotice(const char *fmt,...)
Write a notice out to the notice handler.
Definition: lwutil.c:54
void lwgeom_geos_error(const char *fmt,...)
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:106
LWGEOM * GEOS2LWGEOM(const GEOSGeometry *geom, char want3d)

Here is the call graph for this function:

Here is the caller graph for this function: