The correct behavior is still being discussed here:
http://trac.osgeo.org/postgis/ticket/1987
Better reduce the noise...
git-svn-id: http://svn.osgeo.org/postgis/trunk@10822
b70326c6-7e19-0410-871a-
916f4a2858ee
- ST_Slope and ST_Aspect return pixel values in degrees instead of radians.
- #1653, Removed srid parameter from ST_Resample(raster) and variants
with reference raster no longer apply reference raster's SRID.
- - ST_Simplify returns NULL on EMPTY input or single-vertex line output
* Deprecated signatures
LWCOLLECTION* lwcollection_simplify(const LWCOLLECTION *igeom, double dist)
{
int i;
- LWCOLLECTION *out = NULL;
+ LWCOLLECTION *out = lwcollection_construct_empty(igeom->type, igeom->srid, FLAGS_GET_Z(igeom->flags), FLAGS_GET_M(igeom->flags));
if( lwcollection_is_empty(igeom) )
- return NULL;
+ return out; /* should we return NULL instead ? */
for( i = 0; i < igeom->ngeoms; i++ )
{
LWGEOM *ngeom = lwgeom_simplify(igeom->geoms[i], dist);
- if ( ngeom ) {
- if ( ! out ) {
- out = lwcollection_construct_empty(igeom->type, igeom->srid, FLAGS_GET_Z(igeom->flags), FLAGS_GET_M(igeom->flags));
- }
- out = lwcollection_add_lwgeom(out, ngeom);
- }
+ if ( ngeom ) out = lwcollection_add_lwgeom(out, ngeom);
}
return out;
LWLINE* lwline_simplify(const LWLINE *iline, double dist)
{
LWLINE *oline;
- POINTARRAY *opts;
LWDEBUG(2, "function called");
/* Skip empty case */
if( lwline_is_empty(iline) )
- return NULL;
+ return lwline_clone(iline);
static const int minvertices = 0; /* TODO: allow setting this */
- opts = ptarray_simplify(iline->points, dist, minvertices);
-
- /* Less points than are needed to form a line, we can't use this */
- if ( opts->npoints < 2 )
- {
- LWDEBUGF(3, "line skipped (% pts)", opts->npoints);
- ptarray_free(opts);
- return NULL;
- }
-
- oline = lwline_construct(iline->srid, NULL, opts);
+ oline = lwline_construct(iline->srid, NULL, ptarray_simplify(iline->points, dist, minvertices));
oline->type = iline->type;
return oline;
}
LWDEBUGF(2, "simplify_polygon3d: simplifying polygon with %d rings", ipoly->nrings);
if( lwpoly_is_empty(ipoly) )
- return NULL;
+ return opoly; /* should we return NULL instead ? */
for (i = 0; i < ipoly->nrings; i++)
{