[gdal-dev] OGR SQL Server driver - Default FID values when there is no FID column?

James.Koch at gtri.gatech.edu James.Koch at gtri.gatech.edu
Wed Sep 15 16:28:28 EDT 2010


Tamas, thanks for the SQL Server driver.  I also did some development on a SQL Server driver for the FalconView software, using OGR's existing MySQL driver as a reference.  One issue I saw was with setting a default FID value, when no FID column is present.  In OGRMSSQLSpatialLayer::GetNextRawFeature(), you set the value to an incrementing counter:



    if( pszFIDColumn != NULL && poStmt->GetColId(pszFIDColumn) > -1 )

        poFeature->SetFID(

            atoi(poStmt->GetColData(poStmt->GetColId(pszFIDColumn))) );

    else

        poFeature->SetFID( iNextShapeId );



Maybe you addressed this elsewhere in your code, but it seems like this causes problems if you expect the FID value to always be preserved for any given feature.  The FID value for a feature will be different before & after a filter is applied to the data set, since new OGRFeature objects are created each time.

Is my understanding of the situation and the driver code correct?  If so, should the FID value stay constant?

Thanks!

Jim Koch
Georgia Tech Research Institute
FalconView Developer
www.falconview.org<http://www.falconview.org>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20100915/1296423a/attachment.html


More information about the gdal-dev mailing list