问题描述
我对spacespaceite非常陌生.我在Max OS Mountain Lion上运行,并且已经安装了SQLite版本3.7.17和libspatialite 4.1.1(使用自制软件)
I'm very new with spatialite. I'm running on Max OS Mountain lion and I have installed SQLite version 3.7.17 and libspatialite 4.1.1 (using homebrew)
我可以在SQLite中正确加载扩展libspatialite:
I can load without error the extension libspatialite in SQLite :
SELECT load_extension('/usr/local/Cellar/libspatialite/4.1.1/lib/libspatialite.dylib');
我可以创建一个简单的表:
I can create a simple table:
sqlite> CREATE TABLE test_geom (
...> id INTEGER NOT NULL
...> PRIMARY KEY AUTOINCREMENT,
...> name TEXT NOT NULL,
...> measured_value DOUBLE NOT NULL);
但是当我添加带有spacealite的几何"列时,会收到以下消息:
but when I add a Geometry column with spatialite I get the following message:
sqlite> SELECT AddGeometryColumn('test_geom', 'the_geom',4326, 'POINT');
AddGeometryColumn() error: unexpected metadata layout
0
我不知道要解决此问题.有人可以帮忙吗?
I have no idea to fix this issue. Can somebody help?
推荐答案
当您将SQLite与Spatialite扩展一起使用时,会发生这种情况.在这种情况下,您需要初始化空间元数据表(在创建数据库后立即执行此操作):
This happens when you are using SQLite with Spatialite extension. In that case, you need to initialize spatial metadata tables (do this right after creating the database):
SELECT InitSpatialMetaData();
另一种选择是在创建数据库时运行Spatialite.然后,将自动创建元数据表.
Another option would be to run Spatialite when creating the database. That will then automatically create the metadata tables.
文档: http://www.gaia- gis.it/gaia-sins/spatialite-cookbook/html/metadata.html
这篇关于无法使用spacespaceite创建列->意外的元数据布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!