[gdal-dev] ogr-pg: GetFeature() speed

Frank Warmerdam warmerdam at pobox.com
Tue Aug 23 10:40:52 EDT 2011


On 11-08-23 04:57 AM, Martin Landa wrote:
> Hi,
>
> I have tested speed of random access to PostGIS features with simple
> testing application.
>
>      // about 1e4 points
>      poLayer = poDS->GetLayerByName("bridges");
>
>      nfeatures = poLayer->GetFeatureCount();
>
>      for (int fid = 1; fid<  nfeatures; fid++)
> 	poFeature = poLayer->GetFeature(fid);

Martin,

I agree with Even's comments about the speed.  I would just add that you
cannot generally assume that features id's are contiguous as is done above.
Also, you are missing feature "0" due to the bounds of your for loop.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list