python - ArcPy AttributeError: 'module' object has no attribute 'FromGeohash'
问题描述
I'm trying to use FromGeohash method in Arcpy but it is failing. Here's my code:
import arcpy
spatial_reference = arcpy.SpatialReference(4326)
print spatial_reference
extent = arcpy.FromGeohash('9q8yyx')
It's giving me the error:
Traceback (most recent call last):
File "C:/Python27/ArcGIS10.7/Scripts/Geohash_Converter.py", line 4, in <module>
extent = arcpy.FromGeohash('9q8yyx')
AttributeError: 'module' object has no attribute 'FromGeohash'
Can anyone tell me what's causing this? Arcpy seems to have been imported correctly.
解决方案
看起来 FromGeohash 函数仅在 ArcPy 的 ArcPro 版本中可用。如果我尝试导入 ArcMap 版本 (10.6),则会收到错误消息:
from arcpy import FromGeohash
Traceback (most recent call last):
File "<input>", line 1, in <module>
ImportError: cannot import name FromGeohash
此外,我能找到的有关 FromGeohash 的唯一文档是 ArcGIS Pro。我在 ArcMap 文档中唯一提到的 Geohash 是针对Data Interoperability 扩展。
所以看起来您要么需要使用 ArcGIS Pro python 解释器,要么使用不同的模块来解码 geohash。看起来这个Python 模块可能有效?
推荐阅读
- java - Java RMI 方法调用连接被 OpenVPN 拒绝
- javascript - 无法在 React js 中加载 PDF 文件
- javascript - 使用 fetch 随机提取数据时,如何跳过 JSON 对象数组?
- python - 将字节写入二进制文件和将解码的字符串写入 unicode 文件之间的区别?
- sqlite - SQLite JDBC 3.30.1(最新)不支持 java.time
- laravel - 将 Typescript 与 Laravel 和 Vue.js 一起使用,导入不使其成为 Vue 组件?
- pandas - 如何使用 .loc 为 pandas 数据框按索引设置值?
- python - Python中的算术移位
- python - 使用 OpenCV 从桌面游戏卡图像中提取艺术品
- python - 在 Property 类创建代码中 self 指的是什么?