Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pySphericalPolygon-0.1.9.tar.gz (4.5 kB view details)

Uploaded Source

File details

Details for the file pySphericalPolygon-0.1.9.tar.gz.

File metadata

File hashes

Hashes for pySphericalPolygon-0.1.9.tar.gz
Algorithm Hash digest
SHA256 2fa30d058e40a91f435cfa200a32948e5d17e97a270ea3e4ff9d621e4f0ffbe3
MD5 da52f1f64ee85007644ec3db1d0f95c5
BLAKE2b-256 e95a45fe8ac5f926765d86a2bfd05b0d9f6eed8c10ec48dee07a5bd55c45d3e6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page