【发布时间】:2021-07-08 12:36:51
【问题描述】:
我正在尝试将 shapefile 导入到不存在的 Postgis 表中。 我正在使用带有 -sql 选项的 ogr2ogr 从 shp 中选择要导入的字段,但是我需要在输出表中创建一个日期字段(在我的输入 shp 中不存在)。 ogr2ogr 中是否有任何选项?
我试过了:
ogr2ogr -f "PostgreSQL" -a_srs "EPSG:4326" PG:"host=<db_host> user=<db_user> password=<db_password> dbname=<db_name>" -nlt MULTIPOLYGON -nln <table_name> -sql "SELECT <shp_field1> AS <pg_field1>, <shp_field2> AS <pg_field2>, current_date AS date FROM <shapeFile>" -overwrite <shapeFile>.shp
但是,我收到一个错误“无法识别的字段名称 current_date”,这显然在我的输入 shapefile 中不存在。 感谢您的帮助。
【问题讨论】: