pysal.lib.weights.
get_points_array_from_shapefile
(shapefile)[源代码]¶从给定的形状文件获取X和Y坐标的数据数组。
参数: |
|
---|---|
返回: |
|
笔记
如果给定的形状文件包含多边形,此函数将返回多边形质心的x和y坐标。
实例
点形状文件
>>> import pysal.lib
>>> from pysal.lib.weights.util import get_points_array_from_shapefile
>>> xy = get_points_array_from_shapefile(pysal.lib.examples.get_path('juvenile.shp'))
>>> xy[:3]
array([[94., 93.],
[80., 95.],
[79., 90.]])
多边形形状文件
>>> xy = get_points_array_from_shapefile(pysal.lib.examples.get_path('columbus.shp'))
>>> xy[:3]
array([[ 8.82721847, 14.36907602],
[ 8.33265837, 14.03162401],
[ 9.01226541, 13.81971908]])