MySQL Forums
Forum List  »  GIS

Point in Polygon Problems
Posted by: Joshua Stine
Date: December 10, 2010 11:45AM

Has anyone else encountered problems with MBRWithin? I understand the concept that the function draws a box around the polygon, but I'm still experiencing some strange results.

Specifically, I converted Zillow's neighborhood data into MySql format and then imported the data into my database. However, when querying the data in some instances it's retuning neighborhoods that aren't very related. Additionally I've checked the Zillow data in my table to verify it's accuracy.

Here's an example, when I run a query to get the neighborhood for the following point (-73.958417 40.772724) in New York I should get "Upper East Side" as the neighborhood. However, the query returns "Central Park, Upper East Side, Upper West Side" - I could maybe see how Central Park would be listed as it's nearby and I guess it could be overlapping in some spots, but that's not the case of the Upper West Side. Here is the MultiPolygon data for the Upper West Side:

-73.958353453646 40.800716287251,
-73.981674861946 40.768529407401,
-73.981447589219 40.768320316492,
-73.981653118785 40.76784622356,
-73.993014734013 40.772580806674,
-73.996368614021 40.774048198156,
-73.996368614021 40.774214760423,
-73.996820711604 40.774452706519,
-73.990991032249 40.782747507429,
-73.988713646742 40.78197486242,
-73.985075659339 40.786257883051,
-73.982418122441 40.79090212229,
-73.976690227379 40.798678642883,
-73.971226449273 40.806039404781,
-73.959659972665 40.801263818674,
-73.958353453646 40.800716287251

Anyway, my basic query is:
SELECT neighborhood_name FROM neighborhood_table WHERE MBRWithin(PointFromText('POINT(-73.958417 40.772724 )'),ogc_geom);

Where ogc_geom represents the MultiPolygon data blob.

Interestingly I also tried implementing the MBRWithin Alternative posted by Gert Serneels http://forums.mysql.com/read.php?23,286574,286574 and interestingly it eliminated the "Central Park" result, but not the more obvious "Upper West Side"

If anyone has dealt with this problem and solved it I would appreciate a response as I'm pulling my hair out!

Options: ReplyQuote


Subject
Views
Written By
Posted
Point in Polygon Problems
4625
December 10, 2010 11:45AM


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.