Shapely 2.0.0 中文文档

  1. 主页
  2. 文档
  3. Shapely 2.0.0 中文文档
  4. User Manual
  5. Interoperation(互操作)
  6. Numpy and Python Arrays(Numpy和Python数组)

Numpy and Python Arrays(Numpy和Python数组)

All geometric objects with coordinate sequences (Point, LinearRing, LineString) provide the Numpy array interface and can thereby be converted or adapted to Numpy arrays.

所有具有坐标序列的几何对象(Point, LinearRing, LineString)都提供了Numpy数组接口,因此可以转换为Numpy数组。

>>> import numpy as np
>>> np.asarray(Point(0, 0).coords)
array([[0., 0.]])
>>> np.asarray(LineString([(0, 0), (1, 1)]).coords)
array([[0., 0.],
       [1., 1.]])

The coordinates of the same types of geometric objects can be had as standard Python arrays of x and y values via the xy attribute.

通过xy属性,同种类型的几何对象的坐标可以作为标准的Python的x、y值数组。

>>> Point(0, 0).xy
(array('d', [0.0]), array('d', [0.0]))
>>> LineString([(0, 0), (1, 1)]).xy
(array('d', [0.0, 1.0]), array('d', [0.0, 1.0]))
标签 ,
这篇文章对您有用吗?

我们要如何帮助您?

欢迎留下您的宝贵建议

Please enter your comment!
Please enter your name here