问题标签 [ogr2ogr]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
646 浏览

postgresql - Add timestamp fields to ogr2ogr import into Postgis

I managed to create a model/schema and insert geo-Points into Postgis using sequelize. Since I have a lot of points (>100K) I am longing back to the old way I used to import, using ogr2ogr (gdal), which was much faster (almost instant instead of >20 minutes). As I would like to continue to work with sequelize after the initial import I still want sequelize to create the model/schema upfront, but then do import with ogr2ogr, and then continue CRUD with sequelize.

Here I found this fragment “[….] One way to get around this is to create your table structures before hand and use OGR2OGR to just load the data.” Which gave me the idea that this could work for Postgres/Postgis as well.

Sequelize creates timestamp columns for createdAt and updatedAt, which I like. But when I use ogr2ogr I get “null value in column "createdAt" violates not-null constraint” as loginfo.

Based on this slightly similar issue I tried to add a createdAt column by adding an -sql option:

The error I get when running this is:

Besides my lack of SQL knowledge I am not sure if this can work at all.

How can I solve this, i.e. make the import with ogr2ogr but keep the timestamp columns?

0 投票
1 回答
435 浏览

php - GDAL ogr2ogr 的输出

我想使用 ogr2ogr 将 .shp 文件转换为 .geojson 格式,我可以从(linux)命令行执行此操作。但是,不是命令行转换,我想从 php 脚本调用转换(使用例如 exec(..) )并将输出直接发送到变量(作为字符串)而不是写入文件。这可能吗?

0 投票
1 回答
1885 浏览

arcgis - 将 .qgs 转换为 .shp

我有一个无法读取的 .QGS 文件,因为 QGIS 不是我可视化地图的主要平台。我们的主要平台是ArcGIS。有什么方法可以将 .QGS 转换为 .shp 或 .mxd?

我正在尝试使用http://www.ogr2gui.ca/来帮助我进行转换,但我意识到没有选择 .QGS 文件的选项。

0 投票
1 回答
523 浏览

bash - gdal ogr2ogr 在转换 kml 文件时产生空文件

我试图在运行的机器上使用终端上的一堆.kml文件。gdal ogr2ogrMac OS 10.12

没有错误消息,但输出文件为空。.kml文件是谷歌位置历史下载。

我正在使用的代码是:

我也以同样的运气尝试了其他格式。

0 投票
0 回答
857 浏览

python - 通过使用 Osgeo4w shell。蟒蛇脚本

我正在尝试编写一个脚本来创建对 WFS 服务的多个 ogr2ogr 调用(在循环中)。出于某种原因,我不能使用 osgeo 库(它是一台工作计算机,访问权限有限..),所以我想我会试试 Subprocess 库。

到目前为止,我的过程是:

  • 打开 OSGeo4W 外壳
  • 将字符串从脚本传输到 shell 命令行
  • 循环多个 ogr2ogr 调用

代码:

我知道 ogr2ogr 调用有效,但似乎无法让命令行“输入”。如果这是一个完全错误的方法,请告诉我。我感谢所有的帮助。

0 投票
0 回答
120 浏览

sql-server - 来自 TSQL 存储过程的 ogr2ogr 批处理文件

我有一个带有以下 sql 的存储过程

这意味着运行包含

pushd 创建一个临时 Z 驱动器来访问 ogr2ogr.exe,然后将 SQL 数据重新投影到新表中。当我运行它时它工作,但从 SQL 失败。我得到以下。

我已授予文件夹 SQL 服务权限(完全控制)。我还尝试在批处理文件中授予权限。xp_CMDShell 也已在服务器上配置。你能从 SQL Server 运行这样的脚本吗?

0 投票
2 回答
2766 浏览

c# - 在 C# 中使用 Gdal 库将 shapefile 转换为 kml

您好我想在 C# 中使用 Gdal 库将 shapefile (shp) 转换为 kml。我写了一个代码,但输出不是 kml 格式。

这是我的代码:

FWTools Shell 的这种转换工作正常,但我需要在我的代码中进行。如果你知道我想念什么,请帮助我。

0 投票
1 回答
522 浏览

sql-server - SQL Server ogr2ogr 批处理无法访问 ogr_MSSQLSpatial.dll

我有一个 ogr2ogr 批处理文件,它将 SQL 数据重新投影到一个新的 SQL Server 表中。

当我手动运行 bat 文件时它工作正常,但如果我通过 SQL Server 存储过程运行 bat 文件,它会失败。我已授予gdal文件夹 SQL 服务权限并且xp_CommandShell也已启用。我正在使用

在 T-SQL 脚本中。

由于某种原因ogr_MSSQLSpatial.dll导致它失败。

错误 1:无法加载请求的 DLL:Z:\BroadSpectrumSQLTreeExtract\ogr2ogr\gdalplugins\ogr_MSSQLSpatial.dll

如果我删除此 dll,脚本将通过 SQL 运行,但这意味着我需要添加 dll 必须处理的额外命令,例如设置源坐标系。我还没有设法让它 100% 工作。我最远的地方是生成重新投影的表格,但几何字段是空的。

DLL 确实包含系统表的 SQL 命令。这可能是阻止它工作的 SQL Server 安全问题吗?

0 投票
1 回答
731 浏览

java - 如何在windows上构建gdal jni

我想使用 ogr2ogr.java,它需要 GDAL jni 才能工作。我已经尝试按照此处提到的说明在 Java (Windows) 中构建 GDAL/OGR 的说明,但是我仍然无法构建它。我正在使用 Windows 7 64 位操作系统。如果有人成功构建它,请告诉我您是如何做到的。

0 投票
2 回答
2480 浏览

postgresql - 将 Postgresql 中的表转换为 Shapefile

到目前为止,我已将阿拉斯加的所有宗地表(带有几何信息)加载到 PostgreSQL。这些表最初以转储格式存储。现在,我想通过 cmd 接口将 Postgres 中的每个表转换为 shapefile ogr2ogr

我的代码如下所示:

但是,系统一直向我返回此信息:无法打开数据源

使用以下驱动程序。