Hacker News new | ask | show | jobs
by sigil 4475 days ago
If you find yourself doing big-time spatial queries, consider using the PostGIS extension for Postgres, which uses R-Trees-on-top-of-GiST indices: http://postgis.net/

In addition to ray-casting and R-Trees, there's another alternative for the "point in polygon test" not mentioned by the article: compute the Winding Number. Appropriate for a very low number of polygons where a full spatial index might be overkill.

http://en.wikipedia.org/wiki/Point_in_polygon#Winding_number...

I think seatgeek made the right choice in this case though with a client-side R-Tree.

Aside: does anyone know what browsers use for hit-testing polygons defined by the <map/> tag?