[fdo-users] SQL Server Spatial 2008 Provider (Beta 1) for FDO Open Source 3.2.3

Orest Halustchak orest.halustchak at autodesk.com
Fri Mar 14 15:58:53 EDT 2008

Hi Crispin,

Regarding ICreateDatastore, here is a simple example that I got from Brent Robinson. It includes setting up a spatial context as well.

void CreateDataStore( FdoIConnection* conn, FdoStringP dsName ) {
    FdoPtr<FdoICreateDataStore> cmd = (FdoICreateDataStore*) conn->CreateCommand(FdoCommandType_CreateDataStore);

    FdoPtr<FdoIDataStorePropertyDictionary> dictionary = cmd->GetDataStoreProperties();

    FdoInt32 count;

    FdoString **names = dictionary->GetPropertyNames(count);

    for ( int i = 0; i < count; i++)
        FdoString  *name = names[i];

        if ( wcscmp( name, L"DataStore" ) == 0 )
            dictionary->SetProperty( name, dsName );


There also is a "Description" property for these data stores if you want to set that one as well.

To setup a spatial context:

    FdoPtr<FdoICreateSpatialcontext) cscCmd =
        (FdoICreateSpatialContext *)conn->CreateCommand( FdoCommandType_CreateSpatialContext );

    cscCmd->SetDescription(L"SC Description");

    // envelope as Polygon
    FdoPtr<FdoFgfGeometryFactory> gf = FdoFgfGeometryFactory::GetInstance();
    FdoPtr<FdoIEnvelope> env = gf->CreateEnvelopeXY(-10000000, -10000000, 10000000, 10000000);
    FdoPtr<FdoIGeometry> geom = gf->CreateGeometry(env);
    FdoPtr<FdoByteArray> ext = gf->GetFgf( geom );
    cscCmd->SetExtent( ext );


-----Original Message-----
From: fdo-users-bounces at lists.osgeo.org [mailto:fdo-users-bounces at lists.osgeo.org] On Behalf Of Orest Halustchak
Sent: Thursday, March 13, 2008 5:29 PM
To: FDO Users Mail List
Subject: RE: [fdo-users] SQL Server Spatial 2008 Provider (Beta 1) for FDO Open Source 3.2.3

Hi Crispin,

See comments below ...


-----Original Message-----
From: fdo-users-bounces at lists.osgeo.org [mailto:fdo-users-bounces at lists.osgeo.org] On Behalf Of Crispin @ 1Spatial
Sent: Thursday, March 13, 2008 4:51 PM
To: fdo-users at lists.osgeo.org
Subject: Re: [fdo-users] SQL Server Spatial 2008 Provider (Beta 1) for FDO Open Source 3.2.3

... some comments on initial work on the provider...  overall I was pleased
how far I could progress with a 64-bit SQLServer 2008 Feb CTP on Win2008
64-bit from an XP client and FDO 3.3, however there are a few showstoppers
in my knowledge, the current Katmai version and possibly the FDO provider...

[OH] Good, we haven't tried the 64 bit server yet, so it's good to see that it works!



 1) I cannot use IInsert command on a "foreign" schema because there is an
exception thrown related to IsAbstractClass - this seems a bit harsh!

[OH] Could you include a code snippet and the schema of the table? Are you getting this on all inserts or only for certain tables?

 2) I do not know what the parameters are to create a new ICreateDataStore.
I could "fudge" it by creating a nonspatial SQLServer datastore that has the
metadata tables etc etc.  Any help here?

[OH] Note that you can create your schema with sql server mgt studio. You can define your tables directly as long as you add pkeys and include reasonable extents on the geometry properties. The provider will pick up all that information automatically. For ICreateDataStore, I'll try to get a sample. The pieces aren't all there yet for creating a plain existing schema datastore, that's something that's still being worked on.

 3) I could not create an autonumber column as all the datatypes e.g. Int_32
said they were not supported for IsAutoGenerated columns.

[OH] Sounds like a bug. Could you open a new ticket for this one.

 4) When inserting into geometry columns I often came across the following
two errors thrown by SQLServer (the second limitation could be an issue -
can the provider generale WKT blobs instead of long geometry text?):

--> "RDBMS: [Microsoft][ODBC SQL Server Driver]Connection is busy with
results for another hstmt "

--> "RDBMS: [Microsoft][ODBC SQL Server Driver]Invalid string or buffer
length "

[OH] Is this reproducible from your end or does it occur at random? If reproducible, could you send us the geometry that you're trying to insert? The connection busy one is odd. Are you doing anything like selecting and inserting at the same time?

 5) When querying the data I got the following excpetion with a spatial

Exception Raised: RDBMS: [Microsoft][ODBC SQL Server Driver][SQL Server]The
STRelate function requires 2 argument(s).
   Source: OSGeo.FDO

[OH] What is the spatial expression that you're using in your select command? This could be a bug that for certain fdo spatial functions we're not generating the correct sql expression.

View this message in context: http://www.nabble.com/SQL-Server-Spatial-2008-Provider-%28Beta-1%29-for-FDO-Open-Source-3.2.3-tp15881423s18162p16038346.html
Sent from the fdo-users mailing list archive at Nabble.com.

fdo-users mailing list
fdo-users at lists.osgeo.org
fdo-users mailing list
fdo-users at lists.osgeo.org

More information about the fdo-users mailing list