用法:
cuspatial.point_in_polygon(test_points_x, test_points_y, poly_offsets, poly_ring_offsets, poly_points_x, poly_points_y)
根據一組點和一組多邊形計算哪些點屬於哪些多邊形。請注意,
polygons_(x,y)
必須指定為封閉多邊形:每個多邊形的第一個和最後一個坐標必須相同。- test_points_x:
測試點的 x 坐標
- test_points_y:
測試點的 y 坐標
- poly_offsets:
每個多邊形中第一個環的起始索引
- poly_ring_offsets:
每個環中第一個點的開始索引
- poly_points_x:
x closed-coordinate 個多邊形點
- poly_points_y:
y closed-coordinate 個多邊形點
- result:cudf.DataFrame
布爾值的 DataFrame,指示每個點是否落在每個多邊形內。
參數:
返回:
例子:
測試 3 個點是否落在兩個多邊形中
>>> result = cuspatial.point_in_polygon( [0, -8, 6.0], # test_points_x [0, -8, 6.0], # test_points_y cudf.Series([0, 1], index=['nyc', 'hudson river']), # poly_offsets [0, 3], # ring_offsets [-10, 5, 5, -10, 0, 10, 10, 0], # poly_points_x [-10, -10, 5, 5, 0, 0, 10, 10], # poly_points_y ) # The result of point_in_polygon is a DataFrame of Boolean # values indicating whether each point (rows) falls within # each polygon (columns). >>> print(result) nyc hudson river 0 True True 1 True False 2 False True # Point 0: (0, 0) falls in both polygons # Point 1: (-8, -8) falls in the first polygon # Point 2: (6.0, 6.0) falls in the second polygon
注意輸入係列 x 和 y 不會索引對齊,而是作為順序數組計算。
相關用法
- Python cuspatial.GeoSeries用法及代碼示例
- Python cuspatial.GeoDataFrame.groupby用法及代碼示例
- Python cuspatial.CubicSpline用法及代碼示例
- Python cuspatial.GeoArrowBuffers用法及代碼示例
- Python cuspatial.quadtree_on_points用法及代碼示例
- Python cuspatial.trajectory_bounding_boxes用法及代碼示例
- Python cuspatial.derive_trajectories用法及代碼示例
- Python cuspatial.directed_hausdorff_distance用法及代碼示例
- Python cuspatial.trajectory_distances_and_speeds用法及代碼示例
- Python cusignal.windows.windows.hann用法及代碼示例
- Python cusignal.windows.windows.general_gaussian用法及代碼示例
- Python cusignal.waveforms.waveforms.chirp用法及代碼示例
- Python cusignal.windows.windows.gaussian用法及代碼示例
- Python cusignal.windows.windows.hamming用法及代碼示例
- Python cusignal.windows.windows.get_window用法及代碼示例
- Python cusignal.waveforms.waveforms.gausspulse用法及代碼示例
- Python cusignal.peak_finding.peak_finding.argrelmin用法及代碼示例
- Python cusignal.windows.windows.bartlett用法及代碼示例
- Python cusignal.spectral_analysis.spectral.welch用法及代碼示例
- Python cusignal.windows.windows.chebwin用法及代碼示例
注:本文由純淨天空篩選整理自rapids.ai大神的英文原創作品 cuspatial.point_in_polygon。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。