File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -1097,25 +1097,25 @@ QgsRectangle QgsOgrProvider::extent() const
1097
1097
}
1098
1098
#endif
1099
1099
1100
+ mExtent ->MinX = std::numeric_limits<double >::max ();
1101
+ mExtent ->MinY = std::numeric_limits<double >::max ();
1102
+ mExtent ->MaxX = -std::numeric_limits<double >::max ();
1103
+ mExtent ->MaxY = -std::numeric_limits<double >::max ();
1104
+
1100
1105
// TODO: This can be expensive, do we really need it!
1101
1106
if ( mOgrLayer == mOgrOrigLayer )
1102
1107
{
1103
1108
mOgrLayer ->GetExtent ( mExtent , true );
1104
1109
}
1105
1110
else
1106
1111
{
1107
- mExtent ->MinX = std::numeric_limits<double >::max ();
1108
- mExtent ->MinY = std::numeric_limits<double >::max ();
1109
- mExtent ->MaxX = -std::numeric_limits<double >::max ();
1110
- mExtent ->MaxY = -std::numeric_limits<double >::max ();
1111
-
1112
1112
gdal::ogr_feature_unique_ptr f;
1113
1113
1114
1114
mOgrLayer ->ResetReading ();
1115
1115
while ( f.reset ( mOgrLayer ->GetNextFeature () ), f )
1116
1116
{
1117
1117
OGRGeometryH g = OGR_F_GetGeometryRef ( f.get () );
1118
- if ( g )
1118
+ if ( g && ! OGR_G_IsEmpty ( g ) )
1119
1119
{
1120
1120
OGREnvelope env;
1121
1121
OGR_G_GetEnvelope ( g, &env );
Original file line number Diff line number Diff line change @@ -589,6 +589,8 @@ def testGeopackageRefreshIfTableListUpdated(self):
589
589
590
590
vl = QgsVectorLayer (u'{}' .format (tmpfile ) + "|layername=" + "test" , 'test' , u'ogr' )
591
591
592
+ self .assertTrue (vl .extent ().isNull ())
593
+
592
594
time .sleep (1 ) # so timestamp gets updated
593
595
ds = ogr .Open (tmpfile , update = 1 )
594
596
ds .CreateLayer ('test2' , geom_type = ogr .wkbPoint )
You can’t perform that action at this time.
0 commit comments