Note that there are some explanatory texts on larger screens.

plurals
  1. POmysql polygon search fails
    primarykey
    data
    text
    <p>In my table I have three geospatial fields:</p> <pre><code>`lat` decimal(12,7) NOT NULL, `lon` decimal(12,7) NOT NULL, `location` point NOT NULL, </code></pre> <p>And three geospatial indices:</p> <pre><code>KEY `lat` (`lat`), KEY `lon` (`lon`), SPATIAL KEY `location` (`location`) </code></pre> <p>I then have a trigger defined as 'on before update' which sets the <code>location</code> from the lat/lon pair like this:</p> <pre><code>FOR EACH ROW SET NEW.location = PointFromText(CONCAT('POINT(',NEW.lat,' ',NEW.lon,')')) </code></pre> <p>I'm pretty certain the data is correct because I can do all sorts of circle queries. Now, I also need to do some polygon queries and just can't get it to return any results! Here's my polygon query:</p> <pre><code>SET @bbox = 'POLYGON((32.70 -117.16, 47.97 -122.19, 44.80 -68.77, 25.77 -80.19, 32.70 -117.16))'; SELECT * , AsText( location ) FROM geo_table WHERE Intersects( location, GeomFromText( @bbox ) ); </code></pre> <p>Running this query through phpMyAdmin I get the following message for both SQL statements:</p> <pre><code># MySQL returned an empty result set (i.e. zero rows). </code></pre> <p>As an FYI, the data points shown in the above SET @bbox are from 4 corners of the US (entered clockwise) and should return 99% of all points but returns nothing. Here are the coordinates: San Diego, CA: +32.70 -117.16 Seatle, WA: 47.97 -122.19 Bangor, Maine: 44.80 -68.77 Miami, FL: 25.77 -80.19 </p> <p>I have also tried this against over 3500 polygons from the NWS CAP 1.1 feed and I get nothing! I figure I must be doing something wrong but, for the life of me, I can't figure out what it is!</p> <p>Any suggestions?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload