Opened 12 years ago

Closed 12 years ago

#3163 closed defect (fixed)

OGRLayer::GetFeatureCount returns a wrong value for SOUNDG layer

Reported by: yilmaz Owned by: warmerdam
Priority: normal Milestone: 1.6.3
Component: OGR_SF Version: 1.6.2
Severity: normal Keywords: feature count, SOUNDG, sounding points


The following two pieces of code return different results:

   // process the layer of sounding points
   if ( ( poLayer = poDS->GetLayerByName("SOUNDG") ) != NULL )
      printf("%d\n", poLayer->GetFeatureCount());


   // process the layer of sounding points
   if ( ( poLayer = poDS->GetLayerByName("SOUNDG") ) != NULL )
      int x = 0;
      while( (poFeature = poLayer->GetNextFeature()) != NULL )
      printf("%d\n", x);

regardless of SPLIT_MULTIPOINT option being ON or OFF.

The first one prints out the value 2, where the second one prints out 772. The same thing possibly does not happen with other layers (e.g. DEPCNT layer).

Change History (4)

comment:1 Changed 12 years ago by warmerdam

Status: newassigned

I tried "ogrinfo GB4X0000.000 SOUNDG" and reported feature count is 14, and the actual number of features is 14. This is without split-multipoint.

Could you confirm if you have the same problem with the above file without split-multipoint on?

I would like to isolate whether this is just a splitting issue or not. If you don't have problems with GB4X0000.000 then I'll likely need access to your file.

comment:2 Changed 12 years ago by yilmaz

I checked it, when SPLIT_MULTIPOINT is OFF, I get 14 features. When it is ON, I get 1228 features.

It behaves in the same way with my original file. So it was my mistake, that is, probably there is no problem when SPLIT_MULTIPOINT is OFF.

comment:3 Changed 12 years ago by yilmaz

That is:

OFF: 14 vs. 14

ON: 14 vs. 1228

comment:4 Changed 12 years ago by Even Rouault

Resolution: fixed
Status: assignedclosed

I've confirmed the issue with test_ogrsf and SPLIT_MULTIPOINT=ON.

Fixed in trunk (r17953) and in branches/1.6 (r17954)

Note: See TracTickets for help on using tickets.