当前位置: 首页 > news >正文

[python]rasterio运行代码警告proj_create_from_database: Cannot find proj.db

这个报错要分原因还有rasterio版本讨论,因此官方给出了十分具体回答

Frequently Asked Questions

What does "RasterioIOError: file.ecw not recognized as a supported file format." mean?

This exception is raised when none of rasterio's format drivers can successfully open the specified dataset. In some cases it might be because the path is malformed, or the file is corrupted. Often, it is because your installation of rasterio does not provide the format driver. ECW, for example, is an optional format driver and is not provided by the rasterio wheels in the Python Package Index. We'd like to keep the size of wheels to < ~20MB, and that means some GDAL features and format drivers must be left out. Other distribution channels for rasterio, such as conda-forge, may have different and larger sets of format drivers.

To see a list of the format drivers provided by your rasterio installation, run in your shell

rio env --formats

or, in a python interpreter,

with rasterio.Env() as env:print(list(env.drivers().items()))

Where is "ERROR 4: Unable to open EPSG support file gcs.csv" coming from and what does it mean?

The full message is "ERROR 4: Unable to open EPSG support file gcs.csv. Try setting the GDAL_DATA environment variable to point to the directory containing EPSG csv files." The GDAL/OGR library prints this text to your process's stdout stream when it can not find the gcs.csv data file it needs to interpret spatial reference system information stored with a dataset. If you've never seen this before, you can summon this message by setting GDAL_DATA to a bogus value in your shell and running a command like ogrinfo:

$ GDAL_DATA="/path/to/nowhere" ogrinfo example.shp -so example
INFO: Open of 'example.shp'using driver 'ESRI Shapefile' successful.Layer name: example
Geometry: Polygon
Feature Count: 67
Extent: (-113.564247, 37.068981) - (-104.970871, 41.996277)
ERROR 4: Unable to open EPSG support file gcs.csv.  Try setting the GDAL_DATA environment variable to point to the directory containing EPSG csv files.

If you're using GDAL software installed by a package management system like apt or yum, or Homebrew, or if you've built and installed it using configure; make; make install, you don't need to set the GDAL_DATA environment variable. That software has the right directory path built in. If you see this error, it's likely a sign that GDAL_DATA is set to a bogus value. Unset GDAL_DATA if it exists and see if that eliminates the error condition and the message.

Important

Activate your conda environments. The GDAL conda package will set GDAL_DATA to the proper value if you activate your conda environment. If you don't activate your conda enviornment, you are likely to see the error message shown above.

Why can't rasterio find proj.db (rasterio versions < 1.2.0)?

If you see rasterio.errors.CRSError: The EPSG code is unknown. PROJ: proj_create_from_database: Cannot find proj.db it is because the PROJ library (one of rasterio's dependencies) cannot find its database of projections and coordinate systems. In some installations the PROJ_LIB (PROJ < 9.1) | PROJ_DATA (PROJ 9.1+) environment variable must be set for PROJ to work properly.

Important

Activate your conda environments. The PROJ conda package will set PROJ_LIB (PROJ < 9.1) | PROJ_DATA (PROJ 9.1+) to the proper value if you activate your conda environment. If you don't activate your conda enviornment, you are likely to see the exception shown above.

Why can't rasterio find proj.db (rasterio from PyPI versions >= 1.2.0)?

Starting with version 1.2.0, rasterio wheels on PyPI include PROJ 7.x and GDAL 3.x. The libraries and modules in these wheels are incompatible with older versions of PROJ that may be installed on your system. If PROJ_LIB (PROJ < 9.1) | PROJ_DATA (PROJ 9.1+) is set in your program's environment and points to an older version of PROJ, you must unset this variable. Rasterio will then use the version of PROJ contained in the wheel.

参考文献:

https://github.com/rasterio/rasterio/blob/main/docs/faq.rst#why-cant-rasterio-find-projdb

http://www.lryc.cn/news/423631.html

相关文章:

  • ThinkPHP5.1.C+CmsEasy-SQL注入
  • Python 绘图进阶之词云图:文本数据的可视化艺术
  • 【Windows】Q-Dir(资源管理器)软件介绍
  • 什么是令牌桶算法?工作原理是什么?使用它有哪些优点和注意事项?
  • C++-类与对象(中上篇)
  • 链表 206.反转链表
  • Ubuntu18.04 配置EtherCAT主站IGH SOEM
  • 航空航天构型管理
  • Visual Studio Code 安装与 C/C++ 语言运行总结
  • Science Robotics 受鳞片启发的可编程机器人结构,可同时进行形状变形和刚度变化
  • SpringBoot 自定义 Starter 实现
  • 「Spring MVC」Session、Cookie
  • Java虚拟机:垃圾回收器
  • ES6-ES13学习笔记
  • 【Qt开发】QtCharts图表——在ui上添加QChartView控件并进行绘图配置
  • Android14 屏幕录制(屏幕投影)和音频播放采集
  • 一行实现88个群智能算法优化混合核极限学习机HKELM的多特征输入单输出的数据回归预测Matlab程序全家桶
  • redis面试(十五)公平锁队列重排
  • python 基础语法os模块
  • 图论------迪杰斯特拉(Dijkstra)算法求单源最短路径。
  • 河工院首届工业设计大赛程序组(挑战赛)题解
  • 文件上传漏洞(二,靶场搭建及漏洞利用)
  • 大厂面试题分享第二期
  • zabbix安装
  • SpringBoot集成日志框架
  • CSS笔记总结(Xmind格式):第三天
  • WordPress原创插件:Keyword-ranking-seo 1.0 关键词排名插件 有利于seo
  • Docker Swarm 管理
  • 跨平台、多格式、云同步,Koodo Reader背后的技术亮点
  • 【Story】如何高效记录并整理编程学习笔记?