Tuesday, 12 November 2019

ogr - Why is every SELECT via a geometry function null?


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



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


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...