ogr – Why is Every SELECT via a Geometry Function Returning Null in Spatialite?

ogrspatialite

I'm using Spatialite (2.3.1, binary from the website) on Windows XP via Java ("Xerial Driver"). SQLite loads fine, also Spatialite seems to be loading successfully. I can even do SELECT-statements. But I can't do SELECT's on geometries. E.g.

SELECT link_id, SRID(GEOMETRY), AsText(GEOMETRY) FROM streets1

returns only null columns except for link_id. How can that be? By the way, I imported this data originally from MapInfo files using ogr2ogr:

ogr2ogr -clipsrc 8.6688 50.1018 8.6794 50.1082 -f "SQLite" streets1.SQLite ~/Desktop/G2AM10101EG2000MAADT/Streets1.TAB

Also I tried:

ogr2ogr -clipsrc 8.6688 50.1018 8.6794 50.1082 -f "SQLite" streets1.SQLite Streets1.TAB nlt GEOMETRY

This also gives the same result…

Thanks, Philip

Best Answer

Found the solution:

The tables are in FDO-Ogr format, you can see that when opening the db with spatialite-gui. Then you need to do:

SELECT AutoFDOStart();

and

SELECT link_id, SRID(GEOMETRY), AsText(GEOMETRY) FROM fdo_streets1

instead of

SELECT link_id, SRID(GEOMETRY), AsText(GEOMETRY) FROM streets1

C.f. here: http://groups.google.com/group/spatialite-users/browse_thread/thread/6750ad7013689a3d

Related Question