This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* is (lon, lat) inside the polygon $p? | |
* use ray casting algorithm (http://en.wikipedia.org/wiki/Point_in_polygon) | |
* ie. project a horizontal line from our point to each segment | |
* code adapted from http://stackoverflow.com/questions/14149099/raycasting-algorithm-with-gps-coordinates | |
*/ | |
function inside_polygon($test_point, $points) { |