Find Point in polygon PHP

后端 未结 8 849
半阙折子戏
半阙折子戏 2020-11-30 19:34

i have a typical question with the Geometric datatype of mysql, polygon.

I have the polygon data, in the form of an array of latitudes and longitudes, ex:

         


        
8条回答
  •  春和景丽
    2020-11-30 20:11

    The popular answer above contains typos. Elsewhere, this code has been cleaned up. The corrected code is as follows:

     $latitude_y != ($vertices_y[$j] > $latitude_y)) &&
        ($longitude_x < ($vertices_x[$j] - $vertices_x[$i]) * ($latitude_y - $vertices_y[$i]) / ($vertices_y[$j] - $vertices_y[$i]) + $vertices_x[$i]) ) ) 
            $c = !$c;
      }
      return $c;
    }
    ?>
    

提交回复
热议问题