geopandas.GeoSeries.get_precision#

GeoSeries.get_precision()[来源]#

返回每个几何图形的Series的精度。

如果之前没有设置精度,则默认值为0,表示使用常规双精度坐标。否则,将返回在几何体上设置的精度网格大小。

对于非几何值返回NaN。

另请参阅

GeoSeries.set_precision

设置精度网格大小

示例

>>> from shapely.geometry import Point
>>> s = geopandas.GeoSeries(
...     [
...         Point(0, 1),
...         Point(0, 1, 2),
...         Point(0, 1.5, 2),
...     ]
... )
>>> s
0          POINT (0 1)
1      POINT Z (0 1 2)
2    POINT Z (0 1.5 2)
dtype: geometry
>>> s.get_precision()
0    0.0
1    0.0
2    0.0
dtype: float64
>>> s1 = s.set_precision(1)
>>> s1
0        POINT (0 1)
1    POINT Z (0 1 2)
2    POINT Z (0 2 2)
dtype: geometry
>>> s1.get_precision()
0    1.0
1    1.0
2    1.0
dtype: float64