问题描述
我想在 amazon-linux 机器上运行grass78,有centOS,没有GUI。好不容易安装了 GRASS78(https://grass.osgeo.org/download/ 的最新稳定版本)。
当我运行以下命令时(在将 GRASS_GUI
env var 设置为 text
之后)
(.venv) [ec2-user@ip-10-0-3-14 volume_calc]$ grass78
Starting GRASS GIS...
ERROR: Path '/home/ec2-user/volume_calc/<UNKNowN>/<UNKNowN>' doesn't exist
Exiting...
我想,有了这个,我可以确定草已经安装好了。
但是请告诉我是否有适当的文档来安装它。我试过这个 (https://copr.fedorainfracloud.org/coprs/neteler/grass78/) 但它失败了,因为 centos7 缺少一个 epel 文件。
现在,我想运行一个 python 脚本,它会给我传递给脚本的多边形对象的体积。我不确定,以哪种方式运行 GRASS。我必须明确启动 Grass 还是使用它 (https://grasswiki.osgeo.org/wiki/GRASS_Python_Scripting_Library)?
另外,我不确定在启动 GRASS 之前需要设置哪些环境变量。
我已经设置了 GRASSBIN
、GISBASE
、GISDBASE
。但我不确定 MAPSET
和 LOCATION
环境变量的值。
而且,每次我使用
from grass.script import gcore
我收到没有找到名为草的模块的错误。
因为我使用的是 centOS,所以我不能做任何类似 sudo apt install grass-core
的事情。当我这样做时,sudo yum install grass
出于某种原因安装了版本grass6.4.4。
我也尝试使用grass_session (pip install grass_session
) 在GRASS 会话中运行代码,但没有运气,二进制文件(即/usr/local/bin/grass78)本身说没有名为grass 的模块.
我正在终端上运行以下命令。
grass78 -c epsg:4326 location --exec python3 /home/ec2-user/volume_calc/grass_calc_vol.py area_file=/home/ec2-user/volume_calc/media/tour_id/temp-testing/area_file.geojson points_file=/home/ec2-user/volume_calc/media/tour_id/temp-testing/points_file.geojson dsm_file=/home/ec2-user/volume_calc/media/tour_id/files/dsm-volume.tif
Starting GRASS GIS...
Creating new GRASS GIS location <location>...
Traceback (most recent call last):
File "/usr/local/bin/grass78",line 2349,in <module>
main()
File "/usr/local/bin/grass78",line 2249,in main
geofile=params.geofile,create_new=True)
File "/usr/local/bin/grass78",line 1003,in set_mapset
create_location(gisdbase,location_name,geofile)
File "/usr/local/bin/grass78",line 794,in create_location
from grass.script import core as gcore # pylint: disable=E0611
ModuleNotFoundError: No module named 'grass'
如果您需要更多关于grass_calc_vol 文件的信息,请告诉我。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)