MySQL Forums
Forum List  »  GIS

Points within polygons
Posted by: Mike McCutcheon
Date: February 18, 2010 06:50PM


I am using 5.1.35 GIS version. I have plotted about 16,000 points, divided the earth into 11 regional polygons and coded each point with a region code. Now I'm trying to check that each point is coded with the correct region code by checking whether the distance between the point and its region polygon = 0.

SELECT POI, r.region_id r1, distance( r.coords_geo, p.loc ) dist
FROM `map_regions` AS r
INNER JOIN map_poiplaces AS p
WHERE distance( r.coords_geo, p.loc ) =0


2 strange things happen:

1. MySQL reckons that each point is:
- in its correct region (which is great, obviously)
- also in my Oceania region even if the point is half way around the world from there.

2. MySQL reckons that a significant minority are not in their correct region, even though they clearly are.


I have checked that the region polygons are closed and do not double back on themselves.

So presumably that means there are no multipolygons ie no holes. (I seem to remember there are some bugs in 5.1.35 which involve multipolygons.)

The polygons don't overlap other polygons.

The polygons don't incorporate the North or South poles.

I don't use altitude in the coordinates as I think they are optional. I have rounded every coord to 4 decimal places.

I'm not a pro programmer and only did my first JOIN this week, so apologies if there's some rubbish code above.

I wonder whether there's a limit to the complexity and number of sides to these region polygons ? The Oceania one is quite large.

Does anything spring to anyone's mind, for example about limitations to polygons or other ways to obtain a solution ?

Thanks. Mike

Options: ReplyQuote

Written By
Points within polygons
February 18, 2010 06:50PM
March 27, 2010 04:29AM
April 09, 2010 01:33AM
April 09, 2010 01:50AM
April 30, 2010 04:43PM
April 30, 2010 06:48PM
April 30, 2010 09:38PM
May 03, 2010 05:33AM
May 06, 2010 08:56AM
May 07, 2010 03:46AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.