# 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
// 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 )
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);
}
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);
}
}
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++)
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;