[gdal-dev] double delay getting feature count

Clay, Bruce bclay at ball.com
Wed Oct 14 15:42:44 EDT 2009


Chaitany:

 

Thanks for your reply.

 

  I would expect to get one delay due to the connection time but I did
not expect one for both the GetFeatureCount and the GetNextFeature.
Both of those calls are on the same layer variable.  I originally had
the GetFeatureCount before the ResetReading.  That gave the same delay.
As it turned out the code show below actually had 3 delays.  One for the
GetNextFeature outside the loop, one for the GetFeatureCount and another
one for the first encounter of the GetNextFeature at the bottom of the
loop.  Apparently the GetFeatureCount is leaving the feature pointer at
the bottom of the loop and we have to take time to move back to the top.

 

I would step into the code but I can't get Visual Studio to dig down
into gdal16.dll for some reason even though it was built as a debug
library.

 

 

Bruce

________________________________

From: Chaitanya kumar CH [mailto:chaitanya.ch at gmail.com] 
Sent: Wednesday, October 14, 2009 2:34 PM
To: Clay, Bruce
Cc: gdal-dev at lists.osgeo.org
Subject: Re: [gdal-dev] double delay getting feature count

 

Bruce,

The GetFeatureCount function gets the value with an SQL query to the
data server. The bottleneck may be at the connection.

On Wed, Oct 14, 2009 at 9:28 PM, Clay, Bruce <bclay at ball.com> wrote:

I have tried several different arrangements trying to get the feature
count from a user selection and I am getting a delay two times for each
query.

 

My current arrangement is

 

OGRLayer *queryLayer = dataSource->ExecuteSQL(fullQueryString, NULL,
"generic");

 

if (queryLayer != NULL)

{

      queryLayer->ResetReading();

      OGRFeature *feature = queryLayer->GetNextFeature();

 

      int numFeatures = queryLayer->GetFeatureCount();

 

. . .Display progress meter then loop reading the features from Oracle

 

 

 

 

I have tried putting the call to GetFeatureCount first and there is no
apparent difference.

 

I am reading data from an Oracle database and using GDAL version 1.6.2
on Windows XP

 

The call to ExecuteSql returns right away but the call to the first
GetNextFeature and the call to GetFeatureCount both have a long delay
depending on the size of the dataset.

 

I need the feature count to use in a progress popup window to let the
user know what is happening.

 

Is there a way to only pay for the query time once and still get the
feature count?

 

 

Bruce

This message and any enclosures are intended only for the addressee.
Please  
notify the sender by email if you are not the intended recipient.  If
you are  
not the intended recipient, you may not use, copy, disclose, or
distribute this  
message or its contents or enclosures to any other person and any such
actions  
may be unlawful.  Ball reserves the right to monitor and review all
messages  
and enclosures sent to or from this email address.


_______________________________________________
gdal-dev mailing list
gdal-dev at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev




-- 
Best regards,
Chaitanya kumar CH.




This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20091014/ed75fb04/attachment-0001.html


More information about the gdal-dev mailing list