从电源查询中调用gpkg上的sqlite3时激活空间矿
我正在尝试通过Excel的功率查询在带有GPKG的几何列的表上进行空间查询。 尝试运行查询时,这样:
= Odbc.Query("database=path/to/gpkg;dsn=SQLite3 Datasource", "select *,st_centroid(geom) as cent from some_layer")
它返回以下错误:
DataSource.Error: ODBC: ERROR [HY000] no such function: st_centroid (1)
但是,如果我事先运行
select load_extension('mod_spatialite')
,则可以正常运行。
我的问题是,当我尝试在电源查询中运行两个命令时,就像这样:
= Odbc.Query("database=path/to/gpkg;dsn=SQLite3 Datasource", "select load_extension('mod_spatialite');#(lf)select * from some_layer")
我会收到以下错误:
DataSource.Error: ODBC: ERROR [HY000] only one SQL statement allowed
所以我的问题是 - 如何设置对SQLite3的调用,该呼叫已经加载了空间扩展名?
I'm trying to make a spatial query on a table with a geometry column, stored in a gpkg, through excel's power query.
when trying to run the query, as such:
= Odbc.Query("database=path/to/gpkg;dsn=SQLite3 Datasource", "select *,st_centroid(geom) as cent from some_layer")
it returns the following error:
DataSource.Error: ODBC: ERROR [HY000] no such function: st_centroid (1)
The following happens also when running from sqlite3 cli:
however, if I run
select load_extension('mod_spatialite')
beforehand, it works.
My problem is that when I try to run two commands in power query, like so:
= Odbc.Query("database=path/to/gpkg;dsn=SQLite3 Datasource", "select load_extension('mod_spatialite');#(lf)select * from some_layer")
I get the following error:
DataSource.Error: ODBC: ERROR [HY000] only one SQL statement allowed
so my question is - how can one setup a call to sqlite3 where the spatialite extension is already loaded?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论