MySQL implementation of ray-casting Algorithm?

后端 未结 7 2084
小蘑菇
小蘑菇 2021-02-01 08:56

We need to figure out a quick and fairly accurate method for point-in-polygon for lat/long values and polygons over google maps. After some research - came across some posts abo

7条回答
  •  耶瑟儿~
    2021-02-01 09:27

    I would write a custom UDF that implements the ray-casting algorithm in C or Delphi or whatever high level tool you use:

    Links for writing a UDF
    Here's sourcecode for a MySQL gis implementation that looks up point on a sphere (use it as a template to see how to interact with the spatial datatypes in MySQL).
    http://www.lenzg.net/archives/220-New-UDF-for-MySQL-5.1-provides-GIS-functions-distance_sphere-and-distance_spheroid.html

    From the MySQL manual:
    http://dev.mysql.com/doc/refman/5.0/en/adding-functions.html

    UDF tutorial for MS Visual C++
    http://rpbouman.blogspot.com/2007/09/creating-mysql-udfs-with-microsoft.html

    UDF tutorial in Delphi:
    Creating a UDF for MySQL in Delphi

    Source-code regarding the ray-casting algorithm
    Pseudo-code: http://rosettacode.org/wiki/Ray-casting_algorithm
    Article in drDobbs (note the link to code at the top of the article): http://drdobbs.com/cpp/184409586
    Delphi (actually FreePascal): http://www.cabiatl.com/mricro/raycast/

提交回复
热议问题