Bruce,<br><br>The GetFeatureCount function gets the value with an SQL query to the data server. The bottleneck may be at the connection.<br><br><div class="gmail_quote">On Wed, Oct 14, 2009 at 9:28 PM, Clay, Bruce <span dir="ltr"><<a href="mailto:bclay@ball.com">bclay@ball.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div link="blue" vlink="purple" lang="EN-US">
<div>
<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">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.</span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">My current arrangement is</span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p class="MsoNormal" style=""><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New";">OGRLayer *queryLayer =
dataSource->ExecuteSQL(fullQueryString, NULL, <font color="#a31515"><span style="color: rgb(163, 21, 21);">"generic"</span></font>);</span></font></p>
<p class="MsoNormal" style=""><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New";"> </span></font></p>
<p class="MsoNormal" style=""><font color="blue" size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New"; color: blue;">if</span></font><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New";"> (queryLayer != NULL)</span></font></p>
<p class="MsoNormal" style=""><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New";">{</span></font></p>
<p class="MsoNormal" style=""><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New";"> queryLayer->ResetReading();</span></font></p>
<p class="MsoNormal" style=""><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New";"> OGRFeature *feature =
queryLayer->GetNextFeature();</span></font></p>
<p class="MsoNormal" style=""><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New";"> </span></font></p>
<p class="MsoNormal" style=""><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New";"> <font color="blue"><span style="color: blue;">int</span></font> numFeatures =
queryLayer->GetFeatureCount();</span></font></p>
<p class="MsoNormal" style=""><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New";"> </span></font></p>
<p class="MsoNormal" style=""><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New";">. . .Display progress meter
then loop reading the features from Oracle</span></font></p>
<p class="MsoNormal" style=""><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New";"> </span></font></p>
<p class="MsoNormal" style=""><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New";"> </span></font></p>
<p class="MsoNormal" style=""><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New";"> </span></font></p>
<p class="MsoNormal" style=""><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New";"> </span></font></p>
<p class="MsoNormal" style=""><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New";">I have tried putting the
call to GetFeatureCount first and there is no apparent difference.</span></font></p>
<p class="MsoNormal" style=""><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New";"> </span></font></p>
<p class="MsoNormal" style=""><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New";">I am reading data from an
Oracle database and using GDAL version 1.6.2 on Windows XP</span></font></p>
<p class="MsoNormal" style=""><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New";"> </span></font></p>
<p class="MsoNormal" style=""><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New";">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.</span></font></p>
<p class="MsoNormal" style=""><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New";"> </span></font></p>
<p class="MsoNormal" style=""><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New";">I need the feature count to use
in a progress popup window to let the user know what is happening.</span></font></p>
<p class="MsoNormal" style=""><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New";"> </span></font></p>
<p class="MsoNormal" style=""><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New";">Is there a way to only pay
for the query time once and still get the feature count?</span></font></p>
<p class="MsoNormal" style=""><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New";"> </span></font></p>
<p class="MsoNormal" style=""><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New";"> </span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">Bruce</span></font></p>
</div>
</div>
<pre>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.</pre>
<br>_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br></blockquote></div><br><br clear="all"><br>-- <br>Best regards,<br>Chaitanya kumar CH.<br>