Skip to content
Permalink
Browse files

Merge linestrings together in union operation. Otherwise geos would c…

…reate a multilinestring containing the linestrings

git-svn-id: http://svn.osgeo.org/qgis/trunk@10869 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Jun 1, 2009
1 parent 6f8f05b commit 092a1bf69405a454938d786f1cc9a42c140063b8
Showing with 14 additions and 1 deletion.
  1. +14 −1 src/core/qgsgeometry.cpp
@@ -5448,7 +5448,20 @@ QgsGeometry* QgsGeometry::combine( QgsGeometry* geometry )

try
{
return fromGeosGeom( GEOSUnion( mGeos, geometry->mGeos ) );
GEOSGeometry* unionGeom = GEOSUnion( mGeos, geometry->mGeos );
QGis::WkbType thisGeomType = wkbType();
QGis::WkbType otherGeomType = geometry->wkbType();
if( (thisGeomType == QGis::WKBLineString || thisGeomType == QGis::WKBLineString25D) \
&& (otherGeomType == QGis::WKBLineString || otherGeomType == QGis::WKBLineString25D) )
{
GEOSGeometry* mergedGeom = GEOSLineMerge(unionGeom);
if(mergedGeom)
{
GEOSGeom_destroy(unionGeom);
unionGeom = mergedGeom;
}
}
return fromGeosGeom(unionGeom);
}
CATCH_GEOS( new QgsGeometry( *this ) ) //return this geometry if union not possible
}

0 comments on commit 092a1bf

Please sign in to comment.
You can’t perform that action at this time.