views:

67

answers:

2

I've got loads of coordinates for a polygon in a database. I also have coordinates for an marker in my database. How do i detect if the marker is inside this polyon.

Note: I use a cronjob to move the marker, and in this cronjob it needs to detect this. So javascript isn't involved!

Shape of polygon is not just a circle or square. It could be for example a country or sea.

A: 

If you use mysql spatial extensions, you can use link text function

Naktibalda
+3  A: 

you should SELECT your polygons and SORT them in two different forms one by the x-axis, one by the y-axis, each time GROUPing them by the same parameter. then make sure the y coordinate of you marker point is between the y-coordinates of the polygon points of the same x. and that the marker y is between the x of the polygon points with the same y.

Neo