MySQL Forums
Forum List  »  GIS

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

Background
----------

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 p.id 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

Problem
-------

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.

Thoughts
--------

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


Subject
Views
Written By
Posted
Points within polygons
7985
February 18, 2010 06:50PM
3241
March 27, 2010 04:29AM
4287
April 09, 2010 01:33AM
3070
April 09, 2010 01:50AM
5361
April 30, 2010 04:43PM
3238
April 30, 2010 06:48PM
2817
April 30, 2010 09:38PM
4253
May 03, 2010 05:33AM
3400
May 06, 2010 08:56AM
4689
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.