Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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/qgis@10869 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Jun 1, 2009
1 parent 71af6e8 commit 615f8d2
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/core/qgsgeometry.cpp
Expand Up @@ -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
}
Expand Down

0 comments on commit 615f8d2

Please sign in to comment.