I used the shp plugin to open ne_10m_admin_0_countries.shp from http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/10m-admin-0-countries.zip Many countries seem to be missing in the rendering. Looking into the issue I think one problem is the handling of polygons, which according to shp spec can have several parts and inner holes. As noted in the code already this is not respected correctly by the plugin at the moment. I tried to work around that using a placemark with a MultiGeometry, treating each part as an outer boundary, but still many polygons were not rendered. Then I used the even more hackish approach below, i.e. one new placemark for each part. Much more polygons were rendered now, but still some seem missing (e.g. spain). diff --git a/src/plugins/runner/shp/ShpRunner.cpp b/src/plugins/runner/shp/ShpRunner.cpp index cd720bc..683b319 100644 --- a/src/plugins/runner/shp/ShpRunner.cpp +++ b/src/plugins/runner/shp/ShpRunner.cpp @@ -128,8 +128,8 @@ void ShpRunner::parseFile( const QString &fileName, DocumentRole role = UnknownD case SHPT_POLYGON: { if ( shape->nParts != 1 ) { - GeoDataPolygon *poly = new GeoDataPolygon; for( int j=0; j<shape->nParts-1; ++j ) { + GeoDataPolygon *poly = new GeoDataPolygon; GeoDataLinearRing ring; for( int k=shape->panPartStart[j]; k<shape->panPartStart[j+1]; ++k ) { ring.append( GeoDataCoordinates( @@ -138,13 +138,15 @@ void ShpRunner::parseFile( const QString &fileName, DocumentRole role = UnknownD } // TODO: outer boundary per SHP spec is for the clockwise ring // and inner holes are anticlockwise - if ( j==0 ) { + if ( j==0 || true ) { poly->setOuterBoundary( ring ); + placemark->setGeometry( poly ); + placemark = new GeoDataPlacemark; + document->append(placemark); } else { poly->appendInnerBoundary( ring ); } } - placemark->setGeometry( poly ); mDebug() << "donut " << placemark->name() << " " << shape->nParts; } else { Reproducible: Always
Please have a look at the ShpRunner.cpp git history for recent changes that might invalidate some of the things said above.
Fixed !