如何在Windows 10命令提示符中运行中心线命令行工具

时间:2019-02-17 18:37:29

标签: python gis gdal

我正在尝试从here运行中心线,但不知道如何执行。

我在此处安装了python 3.7:C:\Python37

我已经下载了软件包依赖项:FionascipyGDALnumpy

我将目录更改为我的站点包中的中心线文件夹,并按照文档(上面的链接)所述运行命令,只是得到一条消息,指出它无法识别create_centerlines为命令。< / p>

enter image description here

3 个答案:

答案 0 :(得分:0)

从您引用的github仓库中,可以从this github更改的create_centerlines文件夹中找到scripts文件。

因此,将目录更改为scripts文件夹并运行create_centerlines应该可以解决您的问题。

cd C:/Users/..../centerline/scripts/

create_centerlines <file>

答案 1 :(得分:0)

找到了一种解决方法,可以为我提供所需的输出。如前所述,当我create_centerlines.py

时不包括pip install centerline

我最终只是从github复制create_centerlines.py代码并将其保存在我的C:\Python37\Lib\site-packages\centerline文件夹中。

在Windows cmd promt中,我称为脚本:

cd C:/Python37/Lib/site-packages/centerline

create_centerlines C:/path-to-polygon-shp/PipePoly.shp C:/path-to-put-output-shp/PipeLine.shp

经过长时间的处理,脚本成功运行,我能够在QGIS中查看PipeLine.shp

enter image description here

答案 2 :(得分:0)

创建虚拟环境并安装centerline程序包后,只要激活了虚拟环境,就应该能够从工作目录运行create_centerlines脚本。

我已经有一段时间没有使用Windows了,但是从内存中,我不得不将Python可执行文件的路径添加到PATH环境变量或according to the Python documentation到{{1 }}变量。也有a closed issue有类似的问题。