mike生成的dbf文件,
有的列表头是一样的,
arcgis可以打开,但使用org2ogr会出错。
如果用arcgis 修改过这个文件,arcgis会修改同名的表头,在表头后加后缀。
L:\ldxy__shape>ogr2ogr -sql "select ST_Centroid(geometry),* from YOU_20_XianZhuang" -dialect sqlite centroid_YOU_20_XianZhuang.shp YOU_20_XianZhuang.shp
ERROR 1: Cannot create virtual table for layer 'YOU_20_XianZhuang' :
CREATE VIRTUAL: invalid SQL statement :
CREATE TABLE "YOU_20_XianZhuang"("Maximum wa" FLOAT,
"Time at ma" FLOAT,
"Maximum cu" FLOAT,
"Time at ma" FLOAT,
"Duration a" FLOAT,
OGR_STYLE VARCHAR HIDDEN,
"GEOMETRY" BLOB_POLYGON_XY_4548,
OGR_NATIVE_DATA VARCHAR,
OGR_NATIVE_MEDIA_TYPE VARCHAR)
ERROR 1: In ExecuteSQL(): sqlite3_prepare_v2(select ST_Centroid(geometry),* from YOU_20_XianZhuang):
no such table: YOU_20_XianZhuang
2019年2月23日星期六
在ogr2ogr命令中使用sql
0、对于表头有空格的情况,可以在sql查询中使用[]将表头包起来,使用单引号或者双引号 会引起不必要的麻烦
How to select a column name with a space in MySQL
1、计算polygon.shp中每个多边形的形心,输出到centroid.shp
ogr2ogr -sql "SELECT ST_Centroid(geometry), * FROM polygon" -dialect sqlite centroid.shp polygon.shp
2、选择水深大于5.0的多边形(注意命令行中单引号、双引号的使用)
ogr2ogr -sql ' SELECT * FROM centroid WHERE "Maximum cu">5.0 ' test.shp centroid.shp
3、输出点的xy坐标
ogr2ogr -sql "SELECT ST_X(geometry) as X, ST_Y(geometry) as Y, * FROM countries_centroid" -dialect sqlite -f CSV out.csv countries_centroid.shp
或者:
ogr2ogr -f CSV output.csv -lco GEOMETRY=AS_XY countries_centroid.shp
更新:2019-02-25,经实践,使用以下流程较好:
(1)先生成点文件
ogr2ogr -sql "select ST_Centroid(geometry),* from WU_20" -dialect sqlite centroid_WU_20.shp WU_20.shp
(2)再将点文件转换为CSV文件
ogr2ogr -dialect sqlite -sql "select ST_X(geometry) as centroid_X, ST_Y(geometry) as centroid_Y, [Maximum wa] as H from centroid_WU_50" -f CSV point_centroid_WU_50.csv centroid_WU_50.shp
How to select a column name with a space in MySQL
1、计算polygon.shp中每个多边形的形心,输出到centroid.shp
ogr2ogr -sql "SELECT ST_Centroid(geometry), * FROM polygon" -dialect sqlite centroid.shp polygon.shp
2、选择水深大于5.0的多边形(注意命令行中单引号、双引号的使用)
ogr2ogr -sql ' SELECT * FROM centroid WHERE "Maximum cu">5.0 ' test.shp centroid.shp
3、输出点的xy坐标
ogr2ogr -sql "SELECT ST_X(geometry) as X, ST_Y(geometry) as Y, * FROM countries_centroid" -dialect sqlite -f CSV out.csv countries_centroid.shp
或者:
ogr2ogr -f CSV output.csv -lco GEOMETRY=AS_XY countries_centroid.shp
更新:2019-02-25,经实践,使用以下流程较好:
(1)先生成点文件
ogr2ogr -sql "select ST_Centroid(geometry),* from WU_20" -dialect sqlite centroid_WU_20.shp WU_20.shp
(2)再将点文件转换为CSV文件
ogr2ogr -dialect sqlite -sql "select ST_X(geometry) as centroid_X, ST_Y(geometry) as centroid_Y, [Maximum wa] as H from centroid_WU_50" -f CSV point_centroid_WU_50.csv centroid_WU_50.shp
混用conda和conda-forge会出问题
按照geopandas的官方文档安装,
conda install -c conda-forge geopandas
结果fiona不能使用。
搜到以下讨论内容:
https://github.com/gboeing/osmnx/issues/25
should-conda-or-conda-forge-be-used-for-python-environments
what-does-the-following-packages-will-be-superseded-by-a-higher-priority-channe
2019年2月21日星期四
2019年2月11日星期一
numpy中的axis
NumPy中的维度(dimension)、轴(axis)、秩(rank)的含义
https://zhuanlan.zhihu.com/p/30960190
https://www.sharpsightlabs.com/blog/numpy-axes-explained/
learning-ai-if-you-suck-at-math-p4-tensors-illustrated-with-cats-27f0002c9b32
Array Programming With NumPy
https://www.geeksforgeeks.org/multidimensional-arrays-c-cpp/
Numpy Cube Visualizer Tool Update
https://www.paraview.org/
https://zhuanlan.zhihu.com/p/30960190
https://www.sharpsightlabs.com/blog/numpy-axes-explained/
learning-ai-if-you-suck-at-math-p4-tensors-illustrated-with-cats-27f0002c9b32
Array Programming With NumPy
https://www.geeksforgeeks.org/multidimensional-arrays-c-cpp/
Numpy Cube Visualizer Tool Update
https://www.paraview.org/
2019年2月10日星期日
订阅:
博文 (Atom)