我什么时候可以在现有数据库或表上初始化空间矿?

发布于 2025-01-29 12:50:25 字数 166 浏览 2 评论 0原文

我正在尝试使用空间将几何列添加到现有的SQLite3表中。我可以在现有数据库上调用“选择initspatialMetadata()”,然后在现有表上的AddGeometryColumn?还是我需要放桌子?还是我需要完全启动一个新的数据库并立即调用InitspatialMetadata(或者使用空间cli创建数据库)?

I'm trying to use spatialite to add a geometry column to an existing sqlite3 table. Can I simply call "select initspatialmetadata()" on my existing database and then AddGeometryColumn on my existing table? Or do I need to drop the table? Or do I need to start a new database entirely and call initspatialmetadata immediately (or alternatively create the database with the spatialite cli)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

掀纱窥君容 2025-02-05 12:50:25

您想在spatialite数据库的现有表上添加新的几何列。

我想向您突出显示

sqlite> select InitSpatialMetaData();
  1. initspatialMetadata()函数在创建新数据库后必须立即调用,并且在尝试调用任何其他空间SQL函数之前,必须立即调用。

  2. 此函数的范围正是在空间内部要求的任何元数据表(并填充)。

  3. 如果已经存在任何元数据表,则此功能根本不应用任何操作。因此,致电更多时间InitspatialMetadata()是没有用但完全无害的。

最后,我以前从未尝试过。但是我认为,您可以使用AddGeometryColumn在现有表上添加一个新列。为什么不尝试这样做。

You wanted to add new geometry column on existing table of spatialite database.

There are few points that I wanted to highlight to you

sqlite> select InitSpatialMetaData();
  1. The InitSpatialMetaData() function must be called immediately after creating a new database, and before attempting to call any other Spatial SQL function.

  2. The scope of this function is exactly the one to create (and populate) any metadata table internally required by SpatiaLite.

  3. If any metadata table already exist, this function doesn't apply any action at all. So, calling more times InitSpatialMetaData() is useless but completely harmless.

And lastly, I had never tried it before. But I think, you can add a new column on your existing table using AddGeometryColumn. Why not try to do this.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文