Skip to main content

FromGeohash

汇总

将 geohash 字符串转换为 WGS 1984 坐标中的 Extent 对象,该对象用于表示 geohash 格网中的相应边界框。

语法

FromGeohash(geohash_string)

参数 说明 数据类型

geohash_string

用于获取 WGS 1984 坐标中的范围的 geohash 字符串。

String

返回值

数据类型 说明

Extent

FromGeohash 可返回 geohash 字符串的 WGS 1984 坐标中的 Extent 对象。

代码示例

从 geohash 字符串返回 Extent 对象。

import arcpy
extent = arcpy.FromGeohash('dp1k05k8')

获取从 geohash 字符串转换得来的 Extent 对象中心的点几何。

import arcpy

# Spatial reference set to GCS_WGS_1984
spatial_reference = arcpy.SpatialReference(4326)

extent = arcpy.FromGeohash('dp1k05k8')
extent_x = (extent.XMax + extent.XMin) / 2
extent_y = (extent.YMax + extent.YMin) / 2

pnt = arcpy.Point(extent_x, extent_y)
pnt_geom = arcpy.PointGeometry(pnt, spatial_reference)