fix #29630 spatialindex for NaN points

This commit is contained in:
Peter Petrik 2019-05-29 09:35:46 +02:00
parent 789a758464
commit c2042a2ee3
2 changed files with 16 additions and 8 deletions

View File

@ -668,13 +668,17 @@ bool QgsPointLocator::rebuildIndex( int maxFeaturesToIndex )
}
}
SpatialIndex::Region r( rect2region( f.geometry().boundingBox() ) );
dataList << new RTree::Data( 0, nullptr, r, f.id() );
const QgsRectangle bbox = f.geometry().boundingBox();
if ( bbox.isFinite() )
{
SpatialIndex::Region r( rect2region( bbox ) );
dataList << new RTree::Data( 0, nullptr, r, f.id() );
if ( mGeoms.contains( f.id() ) )
delete mGeoms.take( f.id() );
mGeoms[f.id()] = new QgsGeometry( f.geometry() );
++indexedCount;
if ( mGeoms.contains( f.id() ) )
delete mGeoms.take( f.id() );
mGeoms[f.id()] = new QgsGeometry( f.geometry() );
++indexedCount;
}
if ( maxFeaturesToIndex != -1 && indexedCount > maxFeaturesToIndex )
{
@ -777,8 +781,8 @@ void QgsPointLocator::onFeatureAdded( QgsFeatureId fid )
}
}
QgsRectangle bbox = f.geometry().boundingBox();
if ( !bbox.isNull() )
const QgsRectangle bbox = f.geometry().boundingBox();
if ( bbox.isFinite() )
{
SpatialIndex::Region r( rect2region( bbox ) );
mRTree->insertData( 0, nullptr, r, f.id() );

View File

@ -379,6 +379,10 @@ bool QgsSpatialIndex::featureInfo( const QgsFeature &f, QgsRectangle &rect, QgsF
id = f.id();
rect = f.geometry().boundingBox();
if ( !rect.isFinite() )
return false;
return true;
}