Opened 14 years ago

Closed 14 years ago

#3471 closed defect (fixed)

Spatialite Geometry Column Type

Reported by: aronrubin Owned by: Even Rouault
Priority: high Milestone: 1.7.2
Component: OGR_SF Version: 1.7.0
Severity: major Keywords: spatialite, sqlite
Cc:

Description

OGRSQLiteTableLayer:CreateField has no consideration of spatialite and resets the geometry type to VARCHAR instead of BLOB. This:

        if ( eGeomFormat == OSGF_WKB )
            strcat( pszNewFieldList, " BLOB" );
        else
            strcat( pszNewFieldList, " VARCHAR" );

Should be:

        if ( eGeomFormat == OSGF_WKB || eGeomFormat == OSGF_Spatialite )
            strcat( pszNewFieldList, " BLOB" );
        else
            strcat( pszNewFieldList, " VARCHAR" );

The effect is data corruption/loss and no functional geometry when a new field is created.

Change History (2)

comment:1 by Even Rouault, 14 years ago

Owner: changed from warmerdam to Even Rouault

comment:2 by Even Rouault, 14 years ago

Resolution: fixed
Status: newclosed

I've applied an equivalent variation of your patch. Thanks.

r19062 /trunk/gdal/ogr/ogrsf_frmts/sqlite/ogrsqlitetablelayer.cpp: Sqlite/Spatialite : avoid CreateField() to alter the type of the geometry column in SpatiaLite format (#3471)

r19063 /branches/1.7/gdal/ogr/ogrsf_frmts/sqlite/ogrsqlitetablelayer.cpp: Sqlite/Spatialite : avoid CreateField() to alter the type of the geometry column in SpatiaLite format (#3471)

r19064 /trunk/autotest/ogr/ogr_sqlite.py: Sqlite/Spatialite : test that CreateField() doesn't alter the type of the geometry column in SpatiaLite format (#3471)

Note: See TracTickets for help on using tickets.