- Split raster/rt_core/rt_api.c and raster/rt_pg/rt_pg.c files into
smaller files for ease of long-term maintenance and development
+ - #1220, lwerror and lwnotice function became internal to liblwgeom
PostGIS 2.1.6
2015/03/20
typedef void (lwinterrupt_callback)();
extern lwinterrupt_callback *lwgeom_register_interrupt_callback(lwinterrupt_callback *);
-/**
- * Write a notice out to the notice handler.
- *
- * Uses standard printf() substitutions.
- * Use for messages you always want output.
- * For debugging, use LWDEBUG() or LWDEBUGF().
- * @ingroup logging
- */
-void lwnotice(const char *fmt, ...);
-
-/**
- * Write a notice out to the error handler.
- *
- * Uses standard printf() substitutions.
- * Use for errors you always want output.
- * For debugging, use LWDEBUG() or LWDEBUGF().
- * @ingroup logging
- */
-void lwerror(const char *fmt, ...);
-
-/**
- * Write a debug message out.
- * Don't call this function directly, use the
- * macros, LWDEBUG() or LWDEBUGF(), for
- * efficiency.
- * @ingroup logging
- */
-void lwdebug(int level, const char *fmt, ...);
-
-
/******************************************************************/
typedef struct {
#include "../postgis_config.h"
+#include "lwgeom_log.h"
+
#include <assert.h>
#include <stdarg.h>
#include <stdint.h>
#endif /* POSTGIS_DEBUG_LEVEL <= 0 */
+/**
+ * Write a notice out to the notice handler.
+ *
+ * Uses standard printf() substitutions.
+ * Use for messages you always want output.
+ * For debugging, use LWDEBUG() or LWDEBUGF().
+ * @ingroup logging
+ */
+void lwnotice(const char *fmt, ...);
+
+/**
+ * Write a notice out to the error handler.
+ *
+ * Uses standard printf() substitutions.
+ * Use for errors you always want output.
+ * For debugging, use LWDEBUG() or LWDEBUGF().
+ * @ingroup logging
+ */
+void lwerror(const char *fmt, ...);
+
+/**
+ * Write a debug message out.
+ * Don't call this function directly, use the
+ * macros, LWDEBUG() or LWDEBUGF(), for
+ * efficiency.
+ * @ingroup logging
+ */
+void lwdebug(int level, const char *fmt, ...);
+
+
+
#endif /* LWGEOM_LOG_H */
GSERIALIZED *g = NULL;
g = gserialized_from_lwgeom(lwgeom, is_geodetic, &ret_size);
- if ( ! g ) lwerror("Unable to serialize lwgeom.");
+ if ( ! g ) lwpgerror("Unable to serialize lwgeom.");
SET_VARSIZE(g, ret_size);
return g;
}
GSERIALIZED *g = NULL;
g = gserialized_from_lwgeom(lwgeom, is_geodetic, &ret_size);
- if ( ! g ) lwerror("Unable to serialize lwgeom.");
+ if ( ! g ) lwpgerror("Unable to serialize lwgeom.");
SET_VARSIZE(g, ret_size);
return g;
}
+
+void
+lwpgnotice(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+
+ pg_notice(fmt, ap);
+
+ va_end(ap);
+}
+
+void
+lwpgerror(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+
+ pg_error(fmt, ap);
+
+ va_end(ap);
+}
Datum LWGEOM_addBBOX(PG_FUNCTION_ARGS);
Datum LWGEOM_dropBBOX(PG_FUNCTION_ARGS);
+void lwpgerror(const char *fmt, ...);
+void lwpgnotice(const char *fmt, ...);
+
#endif /* !defined _LWGEOM_PG_H */
LWGEOM *lwgeom = lwgeom_from_wkb(wkb, wkb_size, LW_PARSER_CHECK_NONE);
if ( ! lwgeom )
- lwerror("Unable to parse WKB");
+ lwpgerror("Unable to parse WKB");
gser = gserialized_geography_from_lwgeom(lwgeom, -1);
lwgeom_free(lwgeom);
}
else
{
- lwerror("geography_distance_cache this cannot happen!");
+ lwpgerror("geography_distance_cache this cannot happen!");
return LW_FAILURE;
}
return;
}
}
- lwerror("Can't find %s geometry backend", newvalue );
+ lwpgerror("Can't find %s geometry backend", newvalue );
}
void lwgeom_init_backend()
static void
grid_print(const gridspec *grid)
{
- lwnotice("GRID(%g %g %g %g, %g %g %g %g)",
+ lwpgnotice("GRID(%g %g %g %g, %g %g %g %g)",
grid->ipx, grid->ipy, grid->ipz, grid->ipm,
grid->xsize, grid->ysize, grid->zsize, grid->msize);
}
in_lwpoint = lwgeom_as_lwpoint(lwgeom_from_gserialized(in_point));
if ( in_lwpoint == NULL )
{
- lwerror("Offset geometry must be a point");
+ lwpgerror("Offset geometry must be a point");
}
grid.xsize = PG_GETARG_FLOAT8(2);
pglwg1 = PG_GETARG_GSERIALIZED_P(0);
if ( gserialized_get_type(pglwg1) != LINETYPE )
{
- lwerror("Shell is not a line");
+ lwpgerror("Shell is not a line");
}
shell = lwgeom_as_lwline(lwgeom_from_gserialized(pglwg1));
offset += INTALIGN(VARSIZE(g));
if ( gserialized_get_type(g) != LINETYPE )
{
- lwerror("Hole %d is not a line", i);
+ lwpgerror("Hole %d is not a line", i);
}
hole = lwgeom_as_lwline(lwgeom_from_gserialized(g));
holes[i] = hole;
if ( ! lwpoint )
{
PG_FREE_IF_COPY(geom, 0);
- lwerror("Argument must be POINT geometries");
+ lwpgerror("Argument must be POINT geometries");
PG_RETURN_NULL();
}
srid = lwpoint->srid;
if ( ! getPoint2d_p(lwpoint->point, 0, &p1) )
{
PG_FREE_IF_COPY(geom, 0);
- lwerror("Error extracting point");
+ lwpgerror("Error extracting point");
PG_RETURN_NULL();
}
lwpoint_free(lwpoint);
if ( ! lwpoint )
{
PG_FREE_IF_COPY(geom, 1);
- lwerror("Argument must be POINT geometries");
+ lwpgerror("Argument must be POINT geometries");
PG_RETURN_NULL();
}
if ( lwpoint->srid != srid )
{
PG_FREE_IF_COPY(geom, 1);
- lwerror("Operation on mixed SRID geometries");
+ lwpgerror("Operation on mixed SRID geometries");
PG_RETURN_NULL();
}
if ( ! getPoint2d_p(lwpoint->point, 0, &p2) )
{
PG_FREE_IF_COPY(geom, 1);
- lwerror("Error extracting point");
+ lwpgerror("Error extracting point");
PG_RETURN_NULL();
}
lwpoint_free(lwpoint);
LWGEOM *lwgeom_in = lwgeom_from_gserialized(input);
LWGEOM *lwgeom_out;
- /* lwnotice("ST_RemoveRepeatedPoints got %p", lwgeom_in); */
+ /* lwpgnotice("ST_RemoveRepeatedPoints got %p", lwgeom_in); */
lwgeom_out = lwgeom_remove_repeated_points(lwgeom_in);
output = geometry_serialize(lwgeom_out);
if ( n == 'y' || n == 'y' ) return LWORD_Y;
if ( n == 'z' || n == 'Z' ) return LWORD_Z;
if ( n == 'm' || n == 'M' ) return LWORD_M;
- lwerror("Invalid ordinate name '%c'. Expected x,y,z or m", n);
+ lwpgerror("Invalid ordinate name '%c'. Expected x,y,z or m", n);
return (LWORD)-1;
}
ospec = PG_GETARG_CSTRING(1);
if ( strlen(ospec) != 2 )
{
- lwerror("Invalid ordinate specification. "
+ lwpgerror("Invalid ordinate specification. "
"Need two letters from the set (x,y,z,m). "
"Got '%s'", ospec);
PG_RETURN_NULL();
/* Check presence of given ordinates */
if ( ( o1 == LWORD_M || o2 == LWORD_M ) && ! gserialized_has_m(in) )
{
- lwerror("Geometry does not have an M ordinate");
+ lwpgerror("Geometry does not have an M ordinate");
PG_RETURN_NULL();
}
if ( ( o1 == LWORD_Z || o2 == LWORD_Z ) && ! gserialized_has_z(in) )
{
- lwerror("Geometry does not have a Z ordinate");
+ lwpgerror("Geometry does not have a Z ordinate");
PG_RETURN_NULL();
}
/* Raise an error if input is not a linestring or multilinestring */
if ( type != LINETYPE && type != MULTILINETYPE )
{
- lwerror("Only LINESTRING and MULTILINESTRING are supported");
+ lwpgerror("Only LINESTRING and MULTILINESTRING are supported");
PG_RETURN_NULL();
}
* if dpa!=NULL it means we didn't close it yet.
* this should never happen.
*/
- if ( dpa != NULL ) lwerror("Something wrong with algorithm");
+ if ( dpa != NULL ) lwpgerror("Something wrong with algorithm");
return ret;
}
/* This is a bug */
else
{
- lwerror("ptarray_locate_between_m returned a POINARRAY set containing POINTARRAY with 0 points");
+ lwpgerror("ptarray_locate_between_m returned a POINARRAY set containing POINTARRAY with 0 points");
}
}
/* Polygon types are not supported */
case POLYGONTYPE:
case MULTIPOLYGONTYPE:
- lwerror("Areal geometries are not supported by locate_between_measures");
+ lwpgerror("Areal geometries are not supported by locate_between_measures");
return NULL;
}
- lwerror("Unkonwn geometry type (%s:%d)", __FILE__, __LINE__);
+ lwpgerror("Unkonwn geometry type (%s:%d)", __FILE__, __LINE__);
return NULL;
}
if ( end_measure < start_measure )
{
- lwerror("locate_between_m: 2nd arg must be bigger then 1st arg");
+ lwpgerror("locate_between_m: 2nd arg must be bigger then 1st arg");
PG_RETURN_NULL();
}
*/
if ( ! hasm )
{
- lwerror("Geometry argument does not have an 'M' ordinate");
+ lwpgerror("Geometry argument does not have an 'M' ordinate");
PG_RETURN_NULL();
}
if ( type == POLYGONTYPE || type == MULTIPOLYGONTYPE || type == COLLECTIONTYPE )
{
- lwerror("Areal or Collection types are not supported");
+ lwpgerror("Areal or Collection types are not supported");
PG_RETURN_NULL();
}
*/
#define HANDLE_GEOS_ERROR(label) { \
if ( ! strstr(lwgeom_geos_errmsg, "InterruptedException") ) \
- lwerror(label": %s", lwgeom_geos_errmsg); \
+ lwpgerror(label": %s", lwgeom_geos_errmsg); \
PG_RETURN_NULL(); \
}
Datum hausdorffdistance(PG_FUNCTION_ARGS)
{
#if POSTGIS_GEOS_VERSION < 32
- lwerror("The GEOS version this PostGIS binary "
+ lwpgerror("The GEOS version this PostGIS binary "
"was compiled against (%d) doesn't support "
"'ST_HausdorffDistance' function (3.2.0+ required)",
POSTGIS_GEOS_VERSION);
if ( gserialized_is_empty(geom1) || gserialized_is_empty(geom2) )
PG_RETURN_NULL();
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(lwpgnotice, lwgeom_geos_error);
g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
if ( 0 == g1 ) /* exception thrown at construction */
Datum hausdorffdistancedensify(PG_FUNCTION_ARGS)
{
#if POSTGIS_GEOS_VERSION < 32
- lwerror("The GEOS version this PostGIS binary "
+ lwpgerror("The GEOS version this PostGIS binary "
"was compiled against (%d) doesn't support "
"'ST_HausdorffDistance' function (3.2.0+ required)",
POSTGIS_GEOS_VERSION);
if ( gserialized_is_empty(geom1) || gserialized_is_empty(geom2) )
PG_RETURN_NULL();
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(lwpgnotice, lwgeom_geos_error);
g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
if ( 0 == g1 ) /* exception thrown at construction */
PG_RETURN_POINTER((GSERIALIZED *)(ARR_DATA_PTR(array)));
/* Ok, we really need GEOS now ;) */
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(lwpgnotice, lwgeom_geos_error);
/*
** Collect the non-empty inputs and stuff them into a GEOS collection
PG_RETURN_POINTER((GSERIALIZED *)(ARR_DATA_PTR(array)));
/* Ok, we really need geos now ;) */
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(lwpgnotice, lwgeom_geos_error);
if ( allpolys )
{
#if POSTGIS_GEOS_VERSION < 33
PG_RETURN_NULL();
- lwerror("The GEOS version this PostGIS binary "
+ lwpgerror("The GEOS version this PostGIS binary "
"was compiled against (%d) doesn't support "
"'GEOSUnaryUnion' function (3.3.0+ required)",
POSTGIS_GEOS_VERSION);
srid = gserialized_get_srid(geom1);
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(lwpgnotice, lwgeom_geos_error);
g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
lwgeom = lwgeom_from_gserialized(geom1);
if ( ! lwgeom ) {
- lwerror("POSTGIS2GEOS: unable to deserialize input");
+ lwpgerror("POSTGIS2GEOS: unable to deserialize input");
PG_RETURN_NULL();
}
PG_RETURN_POINTER(result);
}
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(lwpgnotice, lwgeom_geos_error);
g1 = LWGEOM2GEOS(lwgeom, 0);
lwgeom_free(lwgeom);
srid = gserialized_get_srid(geom1);
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(lwpgnotice, lwgeom_geos_error);
g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
if ( gserialized_is_empty(geom1) )
PG_RETURN_POINTER(geom1);
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(lwpgnotice, lwgeom_geos_error);
g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
if ( 0 == g1 ) /* exception thrown at construction */
nargs = PG_NARGS();
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(lwpgnotice, lwgeom_geos_error);
g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
if ( 0 == g1 ) /* exception thrown at construction */
val = strchr(key, '=');
if ( val == NULL || *(val+1) == '\0' )
{
- lwerror("Missing value for buffer "
+ lwpgerror("Missing value for buffer "
"parameter %s", key);
break;
}
}
else
{
- lwerror("Invalid buffer end cap "
+ lwpgerror("Invalid buffer end cap "
"style: %s (accept: "
"'round', 'flat', 'butt' "
"or 'square'"
}
else
{
- lwerror("Invalid buffer end cap "
+ lwpgerror("Invalid buffer end cap "
"style: %s (accept: "
"'round', 'mitre', 'miter' "
" or 'bevel'"
}
else
{
- lwerror("Invalid buffer parameter: %s (accept: "
+ lwpgerror("Invalid buffer parameter: %s (accept: "
"'endcap', 'join', 'mitre_limit', "
"'miter_limit and "
"'quad_segs')", key);
endCapStyle != DEFAULT_ENDCAP_STYLE ||
joinStyle != DEFAULT_JOIN_STYLE )
{
- lwerror("The GEOS version this PostGIS binary "
+ lwpgerror("The GEOS version this PostGIS binary "
"was compiled against (%d) doesn't support "
"specifying a mitre limit != %d or styles different "
"from 'round' (needs 3.2 or higher)",
Datum ST_OffsetCurve(PG_FUNCTION_ARGS)
{
#if POSTGIS_GEOS_VERSION < 32
- lwerror("The GEOS version this PostGIS binary "
+ lwpgerror("The GEOS version this PostGIS binary "
"was compiled against (%d) doesn't support "
"ST_OffsetCurve function "
"(needs 3.2 or higher)",
/* Check for a useable type */
if ( gserialized_get_type(gser_input) != LINETYPE )
{
- lwerror("ST_OffsetCurve only works with LineStrings");
+ lwpgerror("ST_OffsetCurve only works with LineStrings");
PG_RETURN_NULL();
}
/* Read the lwgeom, check for errors */
lwgeom_input = lwgeom_from_gserialized(gser_input);
if ( ! lwgeom_input )
- lwerror("ST_OffsetCurve: lwgeom_from_gserialized returned NULL");
+ lwpgerror("ST_OffsetCurve: lwgeom_from_gserialized returned NULL");
/* For empty inputs, just echo them back */
if ( lwgeom_is_empty(lwgeom_input) )
val = strchr(key, '=');
if ( val == NULL || *(val+1) == '\0' )
{
- lwerror("ST_OffsetCurve: Missing value for buffer parameter %s", key);
+ lwpgerror("ST_OffsetCurve: Missing value for buffer parameter %s", key);
break;
}
*val = '\0';
}
else
{
- lwerror("Invalid buffer end cap style: %s (accept: "
+ lwpgerror("Invalid buffer end cap style: %s (accept: "
"'round', 'mitre', 'miter' or 'bevel')", val);
break;
}
}
else
{
- lwerror("Invalid buffer parameter: %s (accept: "
+ lwpgerror("Invalid buffer parameter: %s (accept: "
"'join', 'mitre_limit', 'miter_limit and "
"'quad_segs')", key);
break;
lwgeom_result = lwgeom_offsetcurve(lwgeom_as_lwline(lwgeom_input), size, quadsegs, joinStyle, mitreLimit);
if (lwgeom_result == NULL)
- lwerror("ST_OffsetCurve: lwgeom_offsetcurve returned NULL");
+ lwpgerror("ST_OffsetCurve: lwgeom_offsetcurve returned NULL");
gser_result = gserialized_from_lwgeom(lwgeom_result, 0, 0);
lwgeom_free(lwgeom_input);
PG_RETURN_POINTER(result);
}
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(lwpgnotice, lwgeom_geos_error);
g1 = (GEOSGeometry *)POSTGIS2GEOS(geom);
PG_RETURN_POINTER(result);
}
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(lwpgnotice, lwgeom_geos_error);
geosgeom = (GEOSGeometry *)POSTGIS2GEOS(geom);
{
#if POSTGIS_GEOS_VERSION < 35
- lwerror("The GEOS version this PostGIS binary "
+ lwpgerror("The GEOS version this PostGIS binary "
"was compiled against (%d) doesn't support "
"'GEOSClipByRect' function (3.5.0+ required)",
POSTGIS_GEOS_VERSION);
if ( isinf(box1.xmax) || isinf(box1.ymax) || isinf(box1.xmin) || isinf(box1.ymin) ||
isnan(box1.xmax) || isnan(box1.ymax) || isnan(box1.xmin) || isnan(box1.ymin) )
{
- lwnotice("Geometry contains an Inf or NaN coordinate");
+ lwpgnotice("Geometry contains an Inf or NaN coordinate");
PG_RETURN_BOOL(FALSE);
}
}
#endif
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(lwpgnotice, lwgeom_geos_error);
lwgeom = lwgeom_from_gserialized(geom1);
if ( ! lwgeom )
{
- lwerror("unable to deserialize input");
+ lwpgerror("unable to deserialize input");
}
g1 = LWGEOM2GEOS(lwgeom, 0);
lwgeom_free(lwgeom);
/* should we drop the following
* notice now that we have ST_isValidReason ?
*/
- lwnotice("%s", lwgeom_geos_errmsg);
+ lwpgnotice("%s", lwgeom_geos_errmsg);
PG_RETURN_BOOL(FALSE);
}
}
#endif
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(lwpgnotice, lwgeom_geos_error);
g1 = (GEOSGeometry *)POSTGIS2GEOS(geom);
if ( g1 )
Datum isvaliddetail(PG_FUNCTION_ARGS)
{
#if POSTGIS_GEOS_VERSION < 33
- lwerror("The GEOS version this PostGIS binary "
+ lwpgerror("The GEOS version this PostGIS binary "
"was compiled against (%d) doesn't support "
"'isValidDetail' function (3.3.0+ required)",
POSTGIS_GEOS_VERSION);
tupdesc = RelationNameGetTupleDesc("valid_detail");
if ( ! tupdesc )
{
- lwerror("TYPE valid_detail not found");
+ lwpgerror("TYPE valid_detail not found");
PG_RETURN_NULL();
}
flags = PG_GETARG_INT32(1);
}
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(lwpgnotice, lwgeom_geos_error);
g1 = (GEOSGeometry *)POSTGIS2GEOS(geom);
if (valid == 2)
{
/* NOTE: should only happen on OOM or similar */
- lwerror("GEOS isvaliddetail() threw an exception!");
+ lwpgerror("GEOS isvaliddetail() threw an exception!");
PG_RETURN_NULL(); /* never gets here */
}
}
}
}
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(lwpgnotice, lwgeom_geos_error);
g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
if ( 0 == g1 ) /* exception thrown at construction */
POSTGIS_DEBUGF(3, "Contains: type1: %d, type2: %d", type1, type2);
}
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(lwpgnotice, lwgeom_geos_error);
prep_cache = GetPrepGeomCache( fcinfo, geom1, 0 );
PG_RETURN_BOOL(FALSE);
}
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(lwpgnotice, lwgeom_geos_error);
prep_cache = GetPrepGeomCache( fcinfo, geom1, 0 );
POSTGIS_DEBUGF(3, "Covers: type1: %d, type2: %d", type1, type2);
}
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(lwpgnotice, lwgeom_geos_error);
prep_cache = GetPrepGeomCache( fcinfo, geom1, 0 );
}
}
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(lwpgnotice, lwgeom_geos_error);
g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
}
}
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(lwpgnotice, lwgeom_geos_error);
g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
if ( 0 == g1 ) /* exception thrown at construction */
}
}
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(lwpgnotice, lwgeom_geos_error);
prep_cache = GetPrepGeomCache( fcinfo, geom1, geom2 );
if ( prep_cache && prep_cache->prepared_geom )
}
}
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(lwpgnotice, lwgeom_geos_error);
g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1 );
if ( 0 == g1 ) /* exception thrown at construction */
}
}
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(lwpgnotice, lwgeom_geos_error);
g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
if ( 0 == g1 ) /* exception thrown at construction */
errorIfGeometryCollection(geom1,geom2);
error_if_srid_mismatch(gserialized_get_srid(geom1), gserialized_get_srid(geom2));
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(lwpgnotice, lwgeom_geos_error);
g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
if ( 0 == g1 ) /* exception thrown at construction */
#if POSTGIS_GEOS_VERSION >= 33
bnr = PG_GETARG_INT32(2);
#else
- lwerror("The GEOS version this PostGIS binary "
+ lwpgerror("The GEOS version this PostGIS binary "
"was compiled against (%d) doesn't support "
"specifying a boundary node rule with ST_Relate"
" (3.3.0+ required)",
errorIfGeometryCollection(geom1,geom2);
error_if_srid_mismatch(gserialized_get_srid(geom1), gserialized_get_srid(geom2));
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(lwpgnotice, lwgeom_geos_error);
g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1 );
if ( 0 == g1 ) /* exception thrown at construction */
}
}
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(lwpgnotice, lwgeom_geos_error);
g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
if ( gserialized_is_empty(geom) )
PG_RETURN_BOOL(TRUE);
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(lwpgnotice, lwgeom_geos_error);
g1 = (GEOSGeometry *)POSTGIS2GEOS(geom);
if ( 0 == g1 ) /* exception thrown at construction */
if ( gserialized_is_empty(geom) )
PG_RETURN_BOOL(FALSE);
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(lwpgnotice, lwgeom_geos_error);
g1 = (GEOSGeometry *)POSTGIS2GEOS(geom );
if ( 0 == g1 ) /* exception thrown at construction */
lwgeom = GEOS2LWGEOM(geom, want3d);
if ( ! lwgeom )
{
- lwerror("GEOS2POSTGIS: GEOS2LWGEOM returned NULL");
+ lwpgerror("GEOS2POSTGIS: GEOS2LWGEOM returned NULL");
return NULL;
}
LWGEOM *lwgeom = lwgeom_from_gserialized(pglwgeom);
if ( ! lwgeom )
{
- lwerror("POSTGIS2GEOS: unable to deserialize input");
+ lwpgerror("POSTGIS2GEOS: unable to deserialize input");
return NULL;
}
ret = LWGEOM2GEOS(lwgeom, 0);
lwgeom_free(lwgeom);
if ( ! ret )
{
- /* lwerror("POSTGIS2GEOS conversion failed"); */
+ /* lwpgerror("POSTGIS2GEOS conversion failed"); */
return NULL;
}
return ret;
GEOSGeometry *geosgeom;
GSERIALIZED *lwgeom_result;
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(lwpgnotice, lwgeom_geos_error);
geom = PG_GETARG_GSERIALIZED_P(0);
geosgeom = (GEOSGeometry *)POSTGIS2GEOS(geom);
if ( nelems == 0 ) PG_RETURN_NULL();
/* Ok, we really need geos now ;) */
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(lwpgnotice, lwgeom_geos_error);
vgeoms = palloc(sizeof(GEOSGeometry *)*nelems);
offset = 0;
geom1 = PG_GETARG_GSERIALIZED_P(0);
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(lwpgnotice, lwgeom_geos_error);
g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
Datum ST_Snap(PG_FUNCTION_ARGS)
{
#if POSTGIS_GEOS_VERSION < 33
- lwerror("The GEOS version this PostGIS binary "
+ lwpgerror("The GEOS version this PostGIS binary "
"was compiled against (%d) doesn't support "
"'ST_Snap' function (3.3.0+ required)",
POSTGIS_GEOS_VERSION);
Datum ST_SharedPaths(PG_FUNCTION_ARGS)
{
#if POSTGIS_GEOS_VERSION < 33
- lwerror("The GEOS version this PostGIS binary "
+ lwpgerror("The GEOS version this PostGIS binary "
"was compiled against (%d) doesn't support "
"'ST_SharedPaths' function (3.3.0+ required)",
POSTGIS_GEOS_VERSION);
Datum ST_Node(PG_FUNCTION_ARGS)
{
#if POSTGIS_GEOS_VERSION < 33
- lwerror("The GEOS version this PostGIS binary "
+ lwpgerror("The GEOS version this PostGIS binary "
"was compiled against (%d) doesn't support "
"'ST_Node' function (3.3.0+ required)",
POSTGIS_GEOS_VERSION);
break;
default:
- lwerror("ST_MakeValid: unsupported geometry type %s",
+ lwpgerror("ST_MakeValid: unsupported geometry type %s",
lwtype_name(lwgeom_in->type));
PG_RETURN_NULL();
break;
/* Check dimensionality is the same as input */
if ( lwgeom_dimensionality(lwgeom_in) != lwgeom_dimensionality(lwgeom_out) )
{
- lwnotice("lwgeom_clean: dimensional collapse (%d to %d)",
+ lwpgnotice("lwgeom_clean: dimensional collapse (%d to %d)",
lwgeom_dimensionality(lwgeom_in), lwgeom_dimensionality(lwgeom_out));
return NULL;
if ( lwgeom_out->type == COLLECTIONTYPE &&
lwgeom_in->type != COLLECTIONTYPE )
{
- lwnotice("lwgeom_clean: mixed-type output (%s) "
+ lwpgnotice("lwgeom_clean: mixed-type output (%s) "
"from single-type input (%s)",
lwtype_name(lwgeom_out->type),
lwtype_name(lwgeom_in->type));
*/
if ( prepcache->argnum || prepcache->geom || prepcache->prepared_geom )
{
- lwerror("PrepGeomCacheBuilder asked to build new prepcache where one already exists.");
+ lwpgerror("PrepGeomCacheBuilder asked to build new prepcache where one already exists.");
return LW_FAILURE;
}
pghe = GetPrepGeomHashEntry(prepcache->context_callback);
if ( ! pghe )
{
- lwerror("PrepGeomCacheBuilder failed to find hash entry for context %p", prepcache->context_callback);
+ lwpgerror("PrepGeomCacheBuilder failed to find hash entry for context %p", prepcache->context_callback);
return LW_FAILURE;
}
pghe = GetPrepGeomHashEntry(prepcache->context_callback);
if ( ! pghe )
{
- lwerror("PrepGeomCacheCleaner failed to find hash entry for context %p", prepcache->context_callback);
+ lwpgerror("PrepGeomCacheCleaner failed to find hash entry for context %p", prepcache->context_callback);
return LW_FAILURE;
}
pghe->geom = 0;
Datum ST_RelateMatch(PG_FUNCTION_ARGS)
{
#if POSTGIS_GEOS_VERSION < 33
- lwerror("The GEOS version this postgis binary "
+ lwpgerror("The GEOS version this postgis binary "
"was compiled against (%d) doesn't support "
"'ST_RelateMatch' function (3.3.0+ required)",
POSTGIS_GEOS_VERSION);
mat = text2cstring(mat_text);
pat = text2cstring(pat_text);
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(lwpgnotice, lwgeom_geos_error);
result = GEOSRelatePatternMatch(mat, pat);
if (result == 2)
{
lwfree(mat); lwfree(pat);
- lwerror("GEOSRelatePatternMatch: %s", lwgeom_geos_errmsg);
+ lwpgerror("GEOSRelatePatternMatch: %s", lwgeom_geos_errmsg);
PG_RETURN_NULL();
}
Datum box2d_from_geohash(PG_FUNCTION_ARGS);
Datum point_from_geohash(PG_FUNCTION_ARGS);
-static void geohash_lwerror(char *msg, int error_code)
+static void geohash_lwpgerror(char *msg, int error_code)
{
POSTGIS_DEBUGF(3, "ST_Box2dFromGeoHash ERROR %i", error_code);
- lwerror("%s", msg);
+ lwpgerror("%s", msg);
}
#include "lwgeom_export.h"
if (NULL == geohash)
{
- geohash_lwerror("invalid GeoHash representation", 2);
+ geohash_lwpgerror("invalid GeoHash representation", 2);
}
decode_geohash_bbox(geohash, lat, lon, precision);
-static void gml_lwerror(char *msg, int error_code)
+static void gml_lwpgerror(char *msg, int error_code)
{
POSTGIS_DEBUGF(3, "ST_GeomFromGML ERROR %i", error_code);
- lwerror("%s", msg);
+ lwpgerror("%s", msg);
}
/**
if (node_id != NULL)
{
if (!xmlStrcmp(node_id, p))
- gml_lwerror("invalid GML representation", 2);
+ gml_lwpgerror("invalid GML representation", 2);
xmlFree(node_id);
}
}
char *text_in, *text_out;
if (srid_in == SRID_UNKNOWN) return pa; /* nothing to do */
- if (srid_out == SRID_UNKNOWN) gml_lwerror("invalid GML representation", 3);
+ if (srid_out == SRID_UNKNOWN) gml_lwpgerror("invalid GML representation", 3);
text_in = GetProj4StringSPI(srid_in);
text_out = GetProj4StringSPI(srid_out);
int is_planar, err;
if (SPI_OK_CONNECT != SPI_connect ())
- lwerror("gml_is_srid_planar: could not connect to SPI manager");
+ lwpgerror("gml_is_srid_planar: could not connect to SPI manager");
/* A way to find if this projection is planar or geocentric */
sprintf(query, "SELECT position('+units=m ' in proj4text) \
FROM spatial_ref_sys WHERE srid='%d'", srid);
err = SPI_exec(query, 1);
- if (err < 0) lwerror("gml_is_srid_planar: error executing query %d", err);
+ if (err < 0) lwpgerror("gml_is_srid_planar: error executing query %d", err);
/* No entry in spatial_ref_sys */
if (SPI_processed <= 0)
sep = '#';
latlon = false;
}
- else gml_lwerror("unknown spatial reference system", 4);
+ else gml_lwpgerror("unknown spatial reference system", 4);
/* retrieve the last ':' or '#' char */
for (p = (char *) srsname ; *p ; p++);
for (--p ; *p != sep ; p--)
- if (!isdigit(*p)) gml_lwerror("unknown spatial reference system", 5);
+ if (!isdigit(*p)) gml_lwpgerror("unknown spatial reference system", 5);
srs->srid = atoi(++p);
/* Check into spatial_ref_sys that this SRID really exist */
is_planar = gml_is_srid_planar(srs->srid);
if (srs->srid == SRID_UNKNOWN || is_planar == -1)
- gml_lwerror("unknown spatial reference system", 6);
+ gml_lwpgerror("unknown spatial reference system", 6);
/* About lat/lon issue, Cf: http://tinyurl.com/yjpr55z */
srs->reverse_axis = !is_planar && latlon;
else if (st == NEED_DIG_DEC) st = DIG_DEC;
else if (st == NEED_DIG_EXP || st == EXP) st = DIG_EXP;
else if (st == DIG || st == DIG_DEC || st == DIG_EXP);
- else gml_lwerror("invalid GML representation", 7);
+ else gml_lwpgerror("invalid GML representation", 7);
}
else if (*p == '.')
{
if (st == DIG) st = NEED_DIG_DEC;
- else gml_lwerror("invalid GML representation", 8);
+ else gml_lwpgerror("invalid GML representation", 8);
}
else if (*p == '-' || *p == '+')
{
if (st == INIT) st = NEED_DIG;
else if (st == EXP) st = NEED_DIG_EXP;
- else gml_lwerror("invalid GML representation", 9);
+ else gml_lwpgerror("invalid GML representation", 9);
}
else if (*p == 'e' || *p == 'E')
{
if (st == DIG || st == DIG_DEC) st = EXP;
- else gml_lwerror("invalid GML representation", 10);
+ else gml_lwpgerror("invalid GML representation", 10);
}
else if (isspace(*p))
{
- if (!space_after) gml_lwerror("invalid GML representation", 11);
+ if (!space_after) gml_lwpgerror("invalid GML representation", 11);
if (st == DIG || st == DIG_DEC || st == DIG_EXP)st = END;
else if (st == NEED_DIG_DEC) st = END;
else if (st == END);
- else gml_lwerror("invalid GML representation", 12);
+ else gml_lwpgerror("invalid GML representation", 12);
}
- else gml_lwerror("invalid GML representation", 13);
+ else gml_lwpgerror("invalid GML representation", 13);
}
if (st != DIG && st != NEED_DIG_DEC && st != DIG_DEC && st != DIG_EXP && st != END)
- gml_lwerror("invalid GML representation", 14);
+ gml_lwpgerror("invalid GML representation", 14);
return atof(d);
}
else
{
if (xmlStrlen(gml_ts) > 1 || isdigit(gml_ts[0]))
- gml_lwerror("invalid GML representation", 15);
+ gml_lwpgerror("invalid GML representation", 15);
ts = gml_ts[0];
xmlFree(gml_ts);
}
else
{
if (xmlStrlen(gml_cs) > 1 || isdigit(gml_cs[0]))
- gml_lwerror("invalid GML representation", 16);
+ gml_lwpgerror("invalid GML representation", 16);
cs = gml_cs[0];
xmlFree(gml_cs);
}
else
{
if (xmlStrlen(gml_dec) > 1 || isdigit(gml_dec[0]))
- gml_lwerror("invalid GML representation", 17);
+ gml_lwpgerror("invalid GML representation", 17);
dec = gml_dec[0];
xmlFree(gml_dec);
}
if (cs == ts || cs == dec || ts == dec)
- gml_lwerror("invalid GML representation", 18);
+ gml_lwpgerror("invalid GML representation", 18);
/* HasZ, !HasM, 1 Point */
dpa = ptarray_construct_empty(1, 0, 1);
*p = '\0';
gml_dims++;
- if (*(p+1) == '\0') gml_lwerror("invalid GML representation", 19);
+ if (*(p+1) == '\0') gml_lwpgerror("invalid GML representation", 19);
if (gml_dims == 1) pt.x = parse_gml_double(q, false, true);
else if (gml_dims == 2) pt.y = parse_gml_double(q, false, true);
gml_dims++;
if (gml_dims < 2 || gml_dims > 3)
- gml_lwerror("invalid GML representation", 20);
+ gml_lwpgerror("invalid GML representation", 20);
if (gml_dims == 3)
pt.z = parse_gml_double(q, false, true);
if (!strcmp((char *) xyz->name, "X"))
{
- if (x) gml_lwerror("invalid GML representation", 21);
+ if (x) gml_lwpgerror("invalid GML representation", 21);
c = xmlNodeGetContent(xyz);
p.x = parse_gml_double((char *) c, true, true);
x = true;
}
else if (!strcmp((char *) xyz->name, "Y"))
{
- if (y) gml_lwerror("invalid GML representation", 22);
+ if (y) gml_lwpgerror("invalid GML representation", 22);
c = xmlNodeGetContent(xyz);
p.y = parse_gml_double((char *) c, true, true);
y = true;
}
else if (!strcmp((char *) xyz->name, "Z"))
{
- if (z) gml_lwerror("invalid GML representation", 23);
+ if (z) gml_lwpgerror("invalid GML representation", 23);
c = xmlNodeGetContent(xyz);
p.z = parse_gml_double((char *) c, true, true);
z = true;
}
}
/* Check dimension consistancy */
- if (!x || !y) gml_lwerror("invalid GML representation", 24);
+ if (!x || !y) gml_lwpgerror("invalid GML representation", 24);
if (!z) *hasz = false;
ptarray_append_point(dpa, &p, LW_FALSE);
dim = atoi((char *) dimension);
xmlFree(dimension);
if (dim < 2 || dim > 3)
- gml_lwerror("invalid GML representation", 25);
+ gml_lwpgerror("invalid GML representation", 25);
}
if (dim == 2) *hasz = false;
/* Test again coherent dimensions on each coord */
if (gml_dim == 2) *hasz = false;
if (gml_dim < 2 || gml_dim > 3 || gml_dim != dim)
- gml_lwerror("invalid GML representation", 26);
+ gml_lwpgerror("invalid GML representation", 26);
ptarray_append_point(dpa, &pt, LW_FALSE);
{
dim = atoi((char *) dimension);
xmlFree(dimension);
- if (dim < 2 || dim > 3) gml_lwerror("invalid GML representation", 27);
+ if (dim < 2 || dim > 3) gml_lwpgerror("invalid GML representation", 27);
}
if (dim == 2) *hasz = false;
gml_dim = 0;
}
else if (*(poslist+1) == '\0')
- gml_lwerror("invalid GML representation", 28);
+ gml_lwpgerror("invalid GML representation", 28);
p = poslist+1;
digit = false;
}
}
if (!found || xb == NULL)
- gml_lwerror("invalid GML representation", 29);
+ gml_lwpgerror("invalid GML representation", 29);
if (is_xlink(xb)) xb = get_xlink_node(xb);
if (xb == NULL || xb->children == NULL)
- gml_lwerror("invalid GML representation", 30);
+ gml_lwpgerror("invalid GML representation", 30);
tmp_pa = parse_gml_data(xb->children, hasz, root_srid);
if (tmp_pa->npoints != 1)
- gml_lwerror("invalid GML representation", 31);
+ gml_lwpgerror("invalid GML representation", 31);
parse_gml_srs(xb, &srs);
if (srs.reverse_axis) tmp_pa = ptarray_flip_coordinates(tmp_pa);
}
}
- if (pa == NULL) gml_lwerror("invalid GML representation", 32);
+ if (pa == NULL) gml_lwpgerror("invalid GML representation", 32);
return pa;
}
return lwpoint_as_lwgeom(lwpoint_construct_empty(*root_srid, 0, 0));
pa = parse_gml_data(xnode->children, hasz, root_srid);
- if (pa->npoints != 1) gml_lwerror("invalid GML representation", 34);
+ if (pa->npoints != 1) gml_lwpgerror("invalid GML representation", 34);
parse_gml_srs(xnode, &srs);
if (srs.reverse_axis) pa = ptarray_flip_coordinates(pa);
return lwline_as_lwgeom(lwline_construct_empty(*root_srid, 0, 0));
pa = parse_gml_data(xnode->children, hasz, root_srid);
- if (pa->npoints < 2) gml_lwerror("invalid GML representation", 36);
+ if (pa->npoints < 2) gml_lwpgerror("invalid GML representation", 36);
parse_gml_srs(xnode, &srs);
if (srs.reverse_axis) pa = ptarray_flip_coordinates(pa);
break;
}
}
- if (!found) gml_lwerror("invalid GML representation", 37);
+ if (!found) gml_lwpgerror("invalid GML representation", 37);
ppa = (POINTARRAY**) lwalloc(sizeof(POINTARRAY*));
if (interpolation != NULL)
{
if (strcmp((char *) interpolation, "linear"))
- gml_lwerror("invalid GML representation", 38);
+ gml_lwpgerror("invalid GML representation", 38);
xmlFree(interpolation);
}
ppa[lss] = parse_gml_data(xa->children, hasz, root_srid);
npoints += ppa[lss]->npoints;
if (ppa[lss]->npoints < 2)
- gml_lwerror("invalid GML representation", 39);
+ gml_lwpgerror("invalid GML representation", 39);
lss++;
}
- if (lss == 0) gml_lwerror("invalid GML representation", 40);
+ if (lss == 0) gml_lwpgerror("invalid GML representation", 40);
/* Most common case, a single segment */
if (lss == 1) pa = ppa[0];
if (i > 0 && memcmp( getPoint_internal(pa, npoints),
getPoint_internal(ppa[i], 0),
*hasz ? sizeof(POINT3D) : sizeof(POINT2D)))
- gml_lwerror("invalid GML representation", 41);
+ gml_lwpgerror("invalid GML representation", 41);
/* Aggregate stuff */
memcpy( getPoint_internal(pa, npoints),
if (ppa[0]->npoints < 4
|| (!*hasz && !ptarray_is_closed_2d(ppa[0]))
|| (*hasz && !ptarray_is_closed_3d(ppa[0])))
- gml_lwerror("invalid GML representation", 42);
+ gml_lwpgerror("invalid GML representation", 42);
if (srs.reverse_axis)
ppa[0] = ptarray_flip_coordinates(ppa[0]);
if (ppa[0]->npoints < 4
|| (!*hasz && !ptarray_is_closed_2d(ppa[0]))
|| (*hasz && !ptarray_is_closed_3d(ppa[0])))
- gml_lwerror("invalid GML representation", 43);
+ gml_lwpgerror("invalid GML representation", 43);
if (srs.reverse_axis) ppa[0] = ptarray_flip_coordinates(ppa[0]);
}
/* Found an <exterior> or <outerBoundaryIs> but no rings?!? We're outa here! */
if ( ! ppa )
- gml_lwerror("invalid GML representation", 43);
+ gml_lwpgerror("invalid GML representation", 43);
for (ring=1, xa = xnode->children ; xa != NULL ; xa = xa->next)
{
if (ppa[ring]->npoints < 4
|| (!*hasz && !ptarray_is_closed_2d(ppa[ring]))
|| (*hasz && !ptarray_is_closed_3d(ppa[ring])))
- gml_lwerror("invalid GML representation", 43);
+ gml_lwpgerror("invalid GML representation", 43);
if (srs.reverse_axis) ppa[ring] = ptarray_flip_coordinates(ppa[ring]);
ring++;
}
/* Exterior Ring is mandatory */
- if (ppa == NULL || ppa[0] == NULL) gml_lwerror("invalid GML representation", 44);
+ if (ppa == NULL || ppa[0] == NULL) gml_lwpgerror("invalid GML representation", 44);
if (srs.srid != *root_srid && *root_srid != SRID_UNKNOWN)
{
if (interpolation != NULL)
{
if (strcmp((char *) interpolation, "planar"))
- gml_lwerror("invalid GML representation", 45);
+ gml_lwpgerror("invalid GML representation", 45);
xmlFree(interpolation);
}
if (pa->npoints != 4
|| (!*hasz && !ptarray_is_closed_2d(pa))
|| (*hasz && !ptarray_is_closed_3d(pa)))
- gml_lwerror("invalid GML representation", 46);
+ gml_lwpgerror("invalid GML representation", 46);
if (srs.reverse_axis) pa = ptarray_flip_coordinates(pa);
}
}
/* Exterior Ring is mandatory */
- if (pa == NULL) gml_lwerror("invalid GML representation", 47);
+ if (pa == NULL) gml_lwpgerror("invalid GML representation", 47);
if (srs.srid != *root_srid && *root_srid != SRID_UNKNOWN)
gml_reproject_pa(pa, srs.srid, *root_srid);
/* PolygonPatch */
if (strcmp((char *) xnode->name, "PolygonPatch"))
- gml_lwerror("invalid GML representation", 48);
+ gml_lwpgerror("invalid GML representation", 48);
/* GML SF is resticted to planar interpolation */
interpolation = gmlGetProp(xnode, (xmlChar *) "interpolation");
if (interpolation != NULL)
{
if (strcmp((char *) interpolation, "planar"))
- gml_lwerror("invalid GML representation", 48);
+ gml_lwpgerror("invalid GML representation", 48);
xmlFree(interpolation);
}
if (ppa[0]->npoints < 4
|| (!*hasz && !ptarray_is_closed_2d(ppa[0]))
|| (*hasz && !ptarray_is_closed_3d(ppa[0])))
- gml_lwerror("invalid GML representation", 48);
+ gml_lwpgerror("invalid GML representation", 48);
if (srs.reverse_axis)
ppa[0] = ptarray_flip_coordinates(ppa[0]);
/* Interior but no Exterior ! */
if ( ! ppa )
- gml_lwerror("invalid GML representation", 48);
+ gml_lwpgerror("invalid GML representation", 48);
/* PolygonPatch/interior */
for (ring=1, xa = xnode->children ; xa != NULL ; xa = xa->next)
if (ppa[ring]->npoints < 4
|| (!*hasz && !ptarray_is_closed_2d(ppa[ring]))
|| ( *hasz && !ptarray_is_closed_3d(ppa[ring])))
- gml_lwerror("invalid GML representation", 49);
+ gml_lwpgerror("invalid GML representation", 49);
if (srs.reverse_axis)
ppa[ring] = ptarray_flip_coordinates(ppa[ring]);
}
/* Exterior Ring is mandatory */
- if (ppa == NULL || ppa[0] == NULL) gml_lwerror("invalid GML representation", 50);
+ if (ppa == NULL || ppa[0] == NULL) gml_lwpgerror("invalid GML representation", 50);
if (srs.srid != *root_srid && *root_srid != SRID_UNKNOWN)
{
break;
}
}
- if (!found) gml_lwerror("invalid GML representation", 51);
+ if (!found) gml_lwpgerror("invalid GML representation", 51);
/* Processing gml:PolygonPatch */
for (patch=0, xa = xa->children ; xa != NULL ; xa = xa->next)
/* SQL/MM define ST_CurvePolygon as a single patch only,
cf ISO 13249-3:2009 -> 4.2.9 (p27) */
- if (patch > 1) gml_lwerror("invalid GML representation", 52);
+ if (patch > 1) gml_lwpgerror("invalid GML representation", 52);
geom = parse_gml_patch(xa, hasz, root_srid);
}
- if (!patch) gml_lwerror("invalid GML representation", 53);
+ if (!patch) gml_lwpgerror("invalid GML representation", 53);
return geom;
}
{
xmlFreeDoc(xmldoc);
xmlCleanupParser();
- gml_lwerror("invalid GML representation", 1);
+ gml_lwpgerror("invalid GML representation", 1);
}
lwgeom = parse_gml(xmlroot, &hasz, &root_srid);
while (xa != NULL && (xa->type != XML_ELEMENT_NODE
|| !is_gml_namespace(xa, false))) xa = xa->next;
- if (xa == NULL) gml_lwerror("invalid GML representation", 55);
+ if (xa == NULL) gml_lwpgerror("invalid GML representation", 55);
parse_gml_srs(xa, &srs);
if (*root_srid == SRID_UNKNOWN && srs.srid != SRID_UNKNOWN)
if (!strcmp((char *) xa->name, "MultiGeometry"))
return parse_gml_coll(xa, hasz, root_srid);
- gml_lwerror("invalid GML representation", 56);
+ gml_lwpgerror("invalid GML representation", 56);
return NULL; /* Never reach */
}
{
xmlFreeDoc(xmldoc);
xmlCleanupParser();
- lwerror("invalid KML representation");
+ lwpgerror("invalid KML representation");
}
lwgeom = parse_kml(xmlroot, &hasz);
for (st = INIT, p = d ; *p ; p++)
{
-lwnotice("State: %d, *p=%c", st, *p);
+lwpgnotice("State: %d, *p=%c", st, *p);
if (isdigit(*p))
{
else if (st == NEED_DIG_DEC) st = DIG_DEC;
else if (st == NEED_DIG_EXP || st == EXP) st = DIG_EXP;
else if (st == DIG || st == DIG_DEC || st == DIG_EXP);
- else lwerror("invalid KML representation");
+ else lwpgerror("invalid KML representation");
}
else if (*p == '.')
{
if (st == DIG) st = NEED_DIG_DEC;
- else lwerror("invalid KML representation");
+ else lwpgerror("invalid KML representation");
}
else if (*p == '-' || *p == '+')
{
if (st == INIT) st = NEED_DIG;
else if (st == EXP) st = NEED_DIG_EXP;
- else lwerror("invalid KML representation");
+ else lwpgerror("invalid KML representation");
}
else if (*p == 'e' || *p == 'E')
{
if (st == DIG || st == DIG_DEC) st = EXP;
- else lwerror("invalid KML representation");
+ else lwpgerror("invalid KML representation");
}
else if (isspace(*p))
{
- if (!space_after) lwerror("invalid KML representation");
+ if (!space_after) lwpgerror("invalid KML representation");
if (st == DIG || st == DIG_DEC || st == DIG_EXP)st = END;
else if (st == NEED_DIG_DEC) st = END;
else if (st == END);
- else lwerror("invalid KML representation");
+ else lwpgerror("invalid KML representation");
}
- else lwerror("invalid KML representation");
+ else lwpgerror("invalid KML representation");
}
if (st != DIG && st != NEED_DIG_DEC && st != DIG_DEC && st != DIG_EXP && st != END)
- lwerror("invalid KML representation");
+ lwpgerror("invalid KML representation");
return atof(d);
}
POINT4D pt;
double d;
- if (xnode == NULL) lwerror("invalid KML representation");
+ if (xnode == NULL) lwpgerror("invalid KML representation");
for (found = false ; xnode != NULL ; xnode = xnode->next)
{
found = true;
break;
}
- if (!found) lwerror("invalid KML representation");
+ if (!found) lwpgerror("invalid KML representation");
/* We begin to retrieve coordinates string */
kml_coord = xmlNodeGetContent(xnode);
while (*p && isspace(*p)) ++p;
for (kml_dims=0; *p ; p++)
{
-//lwnotice("*p:%c, kml_dims:%d", *p, kml_dims);
+//lwpgnotice("*p:%c, kml_dims:%d", *p, kml_dims);
if ( isdigit(*p) || *p == '+' || *p == '-' || *p == '.' ) {
kml_dims++;
errno = 0; d = strtod(p, &q);
if ( errno != 0 ) {
// TODO: destroy dpa, return NULL
- lwerror("invalid KML representation"); /*: %s", strerror(errno));*/
+ lwpgerror("invalid KML representation"); /*: %s", strerror(errno));*/
}
if (kml_dims == 1) pt.x = d;
else if (kml_dims == 2) pt.y = d;
else if (kml_dims == 3) pt.z = d;
else {
- lwerror("invalid KML representation"); /* (more than 3 dimensions)"); */
+ lwpgerror("invalid KML representation"); /* (more than 3 dimensions)"); */
// TODO: destroy dpa, return NULL
}
-//lwnotice("after strtod d:%f, *q:%c, kml_dims:%d", d, *q, kml_dims);
+//lwpgnotice("after strtod d:%f, *q:%c, kml_dims:%d", d, *q, kml_dims);
if ( *q && ! isspace(*q) && *q != ',' ) {
- lwerror("invalid KML representation"); /* (invalid character %c follows ordinate value)", *q); */
+ lwpgerror("invalid KML representation"); /* (invalid character %c follows ordinate value)", *q); */
}
/* Look-ahead to see if we're done reading */
while (*q && isspace(*q)) ++q;
if ( isdigit(*q) || *q == '+' || *q == '-' || *q == '.' || ! *q ) {
- if ( kml_dims < 2 ) lwerror("invalid KML representation"); /* (not enough ordinates)"); */
+ if ( kml_dims < 2 ) lwpgerror("invalid KML representation"); /* (not enough ordinates)"); */
else if ( kml_dims < 3 ) *hasz = false;
if ( ! seen_kml_dims ) seen_kml_dims = kml_dims;
else if ( seen_kml_dims != kml_dims ) {
- lwerror("invalid KML representation: mixed coordinates dimension");
+ lwpgerror("invalid KML representation: mixed coordinates dimension");
}
ptarray_append_point(dpa, &pt, LW_TRUE);
kml_dims = 0;
}
p = q-1; /* will be incrementedon next iteration */
-//lwnotice("after look-ahead *p:%c, kml_dims:%d", *p, kml_dims);
+//lwpgnotice("after look-ahead *p:%c, kml_dims:%d", *p, kml_dims);
} else if ( *p != ',' && ! isspace(*p) ) {
- lwerror("invalid KML representation"); /* (unexpected character %c)", *p); */
+ lwpgerror("invalid KML representation"); /* (unexpected character %c)", *p); */
}
}
{
POINTARRAY *pa;
- if (xnode->children == NULL) lwerror("invalid KML representation");
+ if (xnode->children == NULL) lwpgerror("invalid KML representation");
pa = parse_kml_coordinates(xnode->children, hasz);
- if (pa->npoints != 1) lwerror("invalid KML representation");
+ if (pa->npoints != 1) lwpgerror("invalid KML representation");
return (LWGEOM *) lwpoint_construct(4326, NULL, pa);
}
{
POINTARRAY *pa;
- if (xnode->children == NULL) lwerror("invalid KML representation");
+ if (xnode->children == NULL) lwpgerror("invalid KML representation");
pa = parse_kml_coordinates(xnode->children, hasz);
- if (pa->npoints < 2) lwerror("invalid KML representation");
+ if (pa->npoints < 2) lwpgerror("invalid KML representation");
return (LWGEOM *) lwline_construct(4326, NULL, pa);
}
if (ppa[0]->npoints < 4
|| (!*hasz && !ptarray_is_closed_2d(ppa[0]))
|| (*hasz && !ptarray_is_closed_3d(ppa[0])))
- lwerror("invalid KML representation");
+ lwpgerror("invalid KML representation");
}
}
if (ppa[ring]->npoints < 4
|| (!*hasz && !ptarray_is_closed_2d(ppa[ring]))
|| (*hasz && !ptarray_is_closed_3d(ppa[ring])))
- lwerror("invalid KML representation");
+ lwpgerror("invalid KML representation");
ring++;
}
}
/* Exterior Ring is mandatory */
- if (ppa == NULL || ppa[0] == NULL) lwerror("invalid KML representation");
+ if (ppa == NULL || ppa[0] == NULL) lwpgerror("invalid KML representation");
return (LWGEOM *) lwpoly_construct(4326, NULL, ring, ppa);
}
while (xa != NULL && (xa->type != XML_ELEMENT_NODE
|| !is_kml_namespace(xa, false))) xa = xa->next;
- if (xa == NULL) lwerror("invalid KML representation");
+ if (xa == NULL) lwpgerror("invalid KML representation");
if (!strcmp((char *) xa->name, "Point"))
return parse_kml_point(xa, hasz);
if (!strcmp((char *) xa->name, "MultiGeometry"))
return parse_kml_multi(xa, hasz);
- lwerror("invalid KML representation");
+ lwpgerror("invalid KML representation");
return NULL; /* Never reach */
}
uint8_t geom_type = gserialized_get_type(pg_lwgeom);
if (POINTTYPE != geom_type)
{
- lwerror("Only points are supported, you tried type %s.", lwtype_name(geom_type));
+ lwpgerror("Only points are supported, you tried type %s.", lwtype_name(geom_type));
}
/* Convert to LWGEOM type */
lwgeom = lwgeom_from_gserialized(pg_lwgeom);
if (format_text == NULL) {
- lwerror("ST_AsLatLonText: invalid format string (null");
+ lwpgerror("ST_AsLatLonText: invalid format string (null");
PG_RETURN_NULL();
}
geom = PG_GETARG_GSERIALIZED_P(0);
if ( gserialized_get_type(geom) != POINTTYPE )
- lwerror("Argument to ST_X() must be a point");
+ lwpgerror("Argument to ST_X() must be a point");
lwgeom = lwgeom_from_gserialized(geom);
point = lwgeom_as_lwpoint(lwgeom);
geom = PG_GETARG_GSERIALIZED_P(0);
if ( gserialized_get_type(geom) != POINTTYPE )
- lwerror("Argument to ST_Y() must be a point");
+ lwpgerror("Argument to ST_Y() must be a point");
lwgeom = lwgeom_from_gserialized(geom);
point = lwgeom_as_lwpoint(lwgeom);
geom = PG_GETARG_GSERIALIZED_P(0);
if ( gserialized_get_type(geom) != POINTTYPE )
- lwerror("Argument to ST_Z() must be a point");
+ lwpgerror("Argument to ST_Z() must be a point");
lwgeom = lwgeom_from_gserialized(geom);
point = lwgeom_as_lwpoint(lwgeom);
geom = PG_GETARG_GSERIALIZED_P(0);
if ( gserialized_get_type(geom) != POINTTYPE )
- lwerror("Argument to ST_M() must be a point");
+ lwpgerror("Argument to ST_M() must be a point");
lwgeom = lwgeom_from_gserialized(geom);
point = lwgeom_as_lwpoint(lwgeom);
if (pa->npoints < startPoint + 2)
{
- lwerror("RTreeCreateLeafNode: npoints = %d, startPoint = %d", pa->npoints, startPoint);
+ lwpgerror("RTreeCreateLeafNode: npoints = %d, startPoint = %d", pa->npoints, startPoint);
}
/*
if ( rtree_cache->index )
{
- lwerror("RTreeBuilder asked to build index where one already exists.");
+ lwpgerror("RTreeBuilder asked to build index where one already exists.");
return LW_FAILURE;
}
else
{
/* Uh oh, shouldn't be here. */
- lwerror("RTreeBuilder got asked to build index on non-polygon");
+ lwpgerror("RTreeBuilder got asked to build index on non-polygon");
return LW_FAILURE;
}
return LW_SUCCESS;
{
if ( ! __sfcgal_init ) {
sfcgal_init();
- sfcgal_set_error_handlers((sfcgal_error_handler_t) lwnotice, (sfcgal_error_handler_t) lwerror);
+ sfcgal_set_error_handlers((sfcgal_error_handler_t) lwpgnotice, (sfcgal_error_handler_t) lwpgerror);
sfcgal_set_alloc_handlers(lwalloc, lwfree);
__sfcgal_init = 1;
}
if (! lwgeom)
{
- lwerror("POSTGIS2SFCGALGeometry: Unable to deserialize input");
+ lwpgerror("POSTGIS2SFCGALGeometry: Unable to deserialize input");
}
g = LWGEOM2SFCGAL(lwgeom);
lwgeom_free(lwgeom);
if (!lwgeom)
{
- lwerror("POSTGIS2SFCGALPreparedGeometry: Unable to deserialize input");
+ lwpgerror("POSTGIS2SFCGALPreparedGeometry: Unable to deserialize input");
}
g = LWGEOM2SFCGAL(lwgeom);
}
/* initialize GEOS */
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(rtinfo, lwgeom_geos_error);
/* use gdal polygonize */
gv = rt_raster_gdal_polygonize(raster, nband, 1, &gvcount);
}
/* initialize GEOS */
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(rtinfo, lwgeom_geos_error);
RASTER_DEBUGF(3, "storing polygons (%d)", nFeatureCount);
raster->height = _r[1];
/* initialize GEOS */
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(rtinfo, lwgeom_geos_error);
/* create reference LWPOLY */
{
*/
/* initialize GEOS */
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(rtinfo, lwgeom_geos_error);
/* convert envelope to geometry */
RASTER_DEBUG(4, "Converting envelope to geometry");
return ES_ERROR;
}
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(rtinfo, lwgeom_geos_error);
/* get LWMPOLY of each band */
if (rt_raster_surface(rast1, nband1, &surface1) != ES_NONE) {
do {
int rtn;
- initGEOS(lwnotice, lwgeom_geos_error);
+ initGEOS(rtinfo, lwgeom_geos_error);
rtn = 1;
for (i = 0; i < 2; i++) {