postgresql - ogr2ogr 查询以“”作为命令的分隔符,并且在查询中导致空响应
问题描述
使用 ogr2ogr 我将地理数据从 postgis 数据库查询到 Geopackage。主要属性是“自然”,用“”包裹。查询也由“”包裹。这会导致一个空的响应/地理包
命令是:
ogr2ogr -f "GPKG" natural_EPSG4326.gpkg -nln natural_EPSG4326_point PG:"host=localhost dbname=osmdatabase user=postgres password=*********" -sql "select * from import.osm_point where "natural" <> ''"
如何在没有“”的情况下包装 ogr2ogr 的 sql 命令来查询“自然”?
解决方案
双引号应该被转义:
ogr2ogr -f "GPKG" natural_EPSG4326.gpkg -nln natural_EPSG4326_point PG:"host=localhost dbname=osmdatabase user=postgres password=*********" -sql "select * from import.osm_point where \"natural\" <> ''"
推荐阅读
- python - 运行我的代码时无法获得 predict_proba
- python - 寻找处理 ML 分类数据的最佳方法
- c# - C# 中带有城市名称的时间偏移格式
- google-sheets - 谷歌表格:计算一串单词中的特定字符
- c++ - 具有 2 个键的 C++ 映射,因此可以使用任何 1 个键来获取值
- javascript - Vuex - 在使用 mapState 数据之前等待 api 调用和初始存储?
- visual-studio-code - Visual Studio 代码不适用于 Xampp
- android - 集成Huawei Crash服务,但Web控制台不出现崩溃
- python - 如何从 pandas DataFrame 中的每个组中选择具有最高值的 N 行
- python-3.x - 循环python中图像与csv列的比较