mirror of
https://git.osgeo.org/gitea/postgis/postgis
synced 2024-10-26 10:02:50 +00:00
- changed add_to_geometry() and collector() so that the sql collect() aggregate returns the simplest possible geometric type, ie. a MULTIPOINT instead of a GEOMETRYCOLLECTIONwhen all of the geometries being collected are of either POINT or MULTIPOINT type
git-svn-id: http://svn.osgeo.org/postgis/trunk@158 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
parent
1e1cf9a0e0
commit
75beff5557
2
Makefile
2
Makefile
|
@ -1,6 +1,6 @@
|
|||
# Configuration Directives
|
||||
#---------------------------------------------------------------
|
||||
# Set USE_PG72 to 1 for PostgreSQL version >= 7.3
|
||||
# Set USE_PG72 to 1 for PostgreSQL version >= 7.2
|
||||
USE_PG72=0
|
||||
#---------------------------------------------------------------
|
||||
# Set USE_PROJ to 1 for Proj4 reprojection support
|
||||
|
|
|
@ -2488,7 +2488,9 @@ Datum segmentize(PG_FUNCTION_ARGS)
|
|||
// collector( geom, geom ) returns a geometry which contains
|
||||
// all the sub_objects from both of the argument geometries
|
||||
|
||||
// returned geometry is always a geomtry collection
|
||||
// returned geometry is the simplest possible, based on the types
|
||||
// of the colelct objects
|
||||
// ie. if all are of either X or multiX, then a multiX is returned
|
||||
// bboxonly types are treated as null geometries (no sub_objects)
|
||||
PG_FUNCTION_INFO_V1( collector );
|
||||
Datum collector( PG_FUNCTION_ARGS )
|
||||
|
@ -2511,7 +2513,6 @@ Datum collector( PG_FUNCTION_ARGS )
|
|||
geom2 = (GEOMETRY *) PG_DETOAST_DATUM(PG_GETARG_DATUM(1));
|
||||
result = (GEOMETRY *)palloc( geom2->size );
|
||||
memcpy( result, geom2, geom2->size );
|
||||
result->type = COLLECTIONTYPE;
|
||||
PG_RETURN_POINTER(result);
|
||||
}
|
||||
|
||||
|
@ -2521,7 +2522,6 @@ Datum collector( PG_FUNCTION_ARGS )
|
|||
geom1 = (GEOMETRY *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
|
||||
result = (GEOMETRY *)palloc( geom1->size );
|
||||
memcpy( result, geom1, geom1->size );
|
||||
result->type = COLLECTIONTYPE;
|
||||
PG_RETURN_POINTER(result);
|
||||
}
|
||||
|
||||
|
@ -2534,8 +2534,7 @@ Datum collector( PG_FUNCTION_ARGS )
|
|||
}
|
||||
result = (GEOMETRY *)palloc( geom1->size );
|
||||
memcpy( result, geom1, geom1->size );
|
||||
result->type = COLLECTIONTYPE;
|
||||
|
||||
|
||||
offsets2 = (int32 *)( ((char *)&(geom2->objType[0])) + sizeof( int32 ) * geom2->nobjs ) ;
|
||||
|
||||
for (i=0; i<geom2->nobjs; i++)
|
||||
|
|
|
@ -2979,22 +2979,22 @@ GEOMETRY *add_to_geometry(GEOMETRY *geom,int sub_obj_size, char *sub_obj, int ty
|
|||
type = POLYGONTYPE;
|
||||
|
||||
|
||||
//simple conversion
|
||||
if (geom->type == POINTTYPE)
|
||||
// change to the simplest possible type that supports the type being added
|
||||
if (geom->type == POINTTYPE || geom->type == MULTIPOINTTYPE)
|
||||
{
|
||||
if (type == POINTTYPE)
|
||||
result->type = MULTIPOINTTYPE;
|
||||
else
|
||||
result->type = COLLECTIONTYPE;
|
||||
}
|
||||
if (geom->type == LINETYPE)
|
||||
if (geom->type == LINETYPE || geom->type == MULTILINETYPE)
|
||||
{
|
||||
if (type == LINETYPE)
|
||||
result->type = MULTILINETYPE;
|
||||
else
|
||||
result->type = COLLECTIONTYPE;
|
||||
}
|
||||
if (geom->type == POLYGONTYPE)
|
||||
if (geom->type == POLYGONTYPE || geom->type == MULTIPOLYGONTYPE)
|
||||
{
|
||||
if (type == POLYGONTYPE)
|
||||
result->type = MULTIPOLYGONTYPE;
|
||||
|
|
Loading…
Reference in a new issue