Algorithms

Detecting Mouse Hover over Irregular Shapes

The classic, brilliant PNPOLY algorithm that dates back to 1970

Joe Honton
JavaScript Fanboi
Published in
4 min readApr 12, 2021
Snapshot of simply.earth, demonstrating the use of mouse hover to identify countries

W. Randolph Franklin’s “point inclusion in polygon” algorithm weighs in at just seven lines of C code. It’s intuitively easy to understand, yet fast enough to work with sophisticated GIS datasets. It’s one of those gems that every advanced…

--

--

Joe Honton
JavaScript Fanboi

Princeps geographus, Read Write Tools