preform point in spherical polygon operations
Project description
Perform point in polygon operations
On github: https://github.com/omrivolk/pySphericalPolygon
Install
pip install pySphericalPolygon
Usage
import pySphericalPolygon as pysp
Create a spherical polygon with vertices [[tetah_1,phi_1],[tetah_2,phi_2]…].
For geographical purpuses tetha is latitude and phi is longtitude.
sp = pysp.SpericalPolygon([[0,0],
[80,30],
[10,60]])
Check if a point is inside
print sp.contains_points([[30,30]])
[ True]
Check many points at once
print sp.contains_points([[30,30],[-30,30],[-90,40]])
[ True False False]
Both vertices and/or points may be specified in radians
print sp.contains_points([[0.52359878,0.52359878],[-0.52359878,0.52359878],[-1.57079633,0.6981317]],radians=True)
[ True False False]
Convention deafult is geographic:
(-π/2 rad) -90° ≤ tetha ≤ 90° (π/2 rad)
(-π rad) -180° ≤ phi ≤ 180° (π rad)
But mathematic convetion is supprted too:
(0 rad) 0° ≤ tetha ≤ 180° (π rad)
(0 rad) 0° ≤ phi ≤ 360° (2π rad)
sp = pysp.SpericalPolygon([[90,0],
[10,30],
[80,60]],convention='math')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.