segasai / q3c

PostgreSQL extension for spatial indexing on a sphere
GNU General Public License v2.0
77 stars 27 forks source link

Clarification regarding limitation #39

Closed Hemanthb1 closed 3 months ago

Hemanthb1 commented 3 months ago

As it was mentioned in the limitations, "polygon of area larger than 25 degree is not supported", does this translate to angular diameter of 25 degree? I am trying to use this package to query, where I encounter sky maps of few 100s to 1000s of square degrees (of different distances)

segasai commented 3 months ago

I am actually not 100% sure of exact number (I've just tried to recompute it and got 35 degrees instead; my geometry is a bit rusty ) but what matters is the distance between two furthest points in the polygon. If the distance is smaller than the critical number all queries will work, as soon as you hit the value there will be some polygons where the query will return the error, and the fraction will increase as you make the polygon bigger and bigger. (basically what matters is that the polygon could be fully projected on one cube face)

Example:

wsdb=> select * from gaia_dr3.gaia_source where q3c_poly_query(ra,dec,ARRAY[[0,0],[90,0],[90,89],[0,89]]);
ERROR:  The polygon is too large. Polygons having diameter >~23 degrees are unsupported
CONTEXT:  SQL function "q3c_poly_query" during inlining
wsdb=>