[AstroPy] Spherical point in polygon test?

John K. Parejko john.parejko at yale.edu
Wed May 7 10:20:56 EDT 2014


Though a bit less general, there is also the the manglepy module for dealing with mangle polygon masks:

https://github.com/mollyswanson/manglepy

based off of:

http://space.mit.edu/~molly/mangle

John

On 7May 2014, at 08:09, Michael Droettboom <mdroe at stsci.edu> wrote:

> The Polygon package is for 2D, not spherical, polygons.  Sometimes the approximation doesn't matter, and you can project from one into the other, preserving area etc.  However, in some cases it's important to stay in spherical space, particularly when the polygon is large or the extent of it isn't       known up front (for example, when doing mosaicing from a large database of images).
> 
> I'm the author of the stsci.sphere package, which does work with spherical polygons in vector space natively.
> 
> With it, you can do:
> 
> ```
> >>> from sphere import SphericalPolygon
> >>> from sphere import vector
> >>> polygon = SphericalPolygon.from_radec(...)
> >>> x, y, z = vector.radec_to_vector(...)
> >>> polygon.point_inside(x, y, z)
> ```
> 
> Mike
> 
> On 05/06/2014 08:36 PM, JJ Kavelaars wrote:
>> https://pypi.python.org/pypi/Polygon/2.0.4
>> 
>> Or version 3 if you are python3. Works well. Has reasonable set of geometric functions. CONTAINs and OVERLAPs IIRC. I use this a few times a year. 
>> 
>> JJ 
>> 
>> On May 6, 2014, at 5:10 PM, Christine Slocum <cslocum at stsci.edu> wrote:
>> 
>>> I can't answer the first question, but you can find the source here:
>>> 
>>> https://svn.stsci.edu/svn/ssb/stsci_python/stsci.sphere/trunk/
>>> 
>>> Christine
>>> 
>>> From: astropy-bounces at scipy.org [astropy-bounces at scipy.org] on behalf of Chris Beaumont [beaumont at hawaii.edu]
>>> Sent: Tuesday, May 06, 2014 7:58 PM
>>> To: astropy
>>> Subject: [AstroPy] Spherical point in polygon test?
>>> 
>>> What's the easiest way to compute whether a set of lat/lon points is inside a spherical quad on the sky?
>>> 
>>> This package claims to do it, but I can't seem to find a good place to download the source
>>> http://ssb.stsci.edu/doc/stsci_python_dev/stsci.sphere.doc/html/
>>> 
>>> Ideas?
>>> Chris
>>> _______________________________________________
>>> AstroPy mailing list
>>> AstroPy at scipy.org
>>> http://mail.scipy.org/mailman/listinfo/astropy
>> 
>> 
>> _______________________________________________
>> AstroPy mailing list
>> 
>> AstroPy at scipy.org
>> http://mail.scipy.org/mailman/listinfo/astropy
> 
> 
> -- 
> Michael Droettboom
> Science Software Branch
> Space Telescope Science Institute
> 
> 
> http://www.droettboom.com
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> http://mail.scipy.org/mailman/listinfo/astropy

--
*************************
John Parejko
john.parejko at yale.edu
http://www.astro.yale.edu/~jp727/
203 432-9759
JWG 465
Department of Physics
Yale University
New Haven, CT
**************************









More information about the AstroPy mailing list