Correct -- no results for the "real" 2nd query ...you got no results for it
either.\
Then 2nd query is this and produces no results...nor should it with the data
given.
SELECT id FROM demo_index
 WHERE minX>=-81.08 AND maxX<=-80.58
   AND minY>=35.00  AND maxY<=35.44;

I think the data point you have for SQL HQ is supposed to be:
1|-80.77490234375|-80.7746963500977|35.3775978088379|35.3778038024902
You have "33...." for miny which puts HQ outside of the query since the
query doesn't do intersections.

Change 33 to 35 and the query will work.  I don't think HQ is really 2
degrees N/S :-)

SQLite version 3.7.16.2 2013-04-12 11:52:43
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> CREATE VIRTUAL TABLE demo_index USING rtree(
   ...>    id,              -- Integer primary key
   ...>    minX, maxX,      -- Minimum and maximum X coordinate
   ...>    minY, maxY       -- Minimum and maximum Y coordinate
   ...> );
sqlite> INSERT INTO demo_index VALUES(
   ...>     1,                   -- Primary key
   ...>     -80.7749, -80.7747,  -- Longitude range
   ...>     33.3776, 35.3778     -- Latitude range
   ...> );
sqlite> INSERT INTO demo_index VALUES(
   ...>     2,
   ...>     -81.0, -79.6,
   ...>     35.0, 36.2
   ...> );
sqlite> SELECT * FROM demo_index WHERE id=1;
1|-80.77490234375|-80.7746963500977|33.3775978088379|35.3778038024902
sqlite> SELECT id FROM demo_index
   ...>  WHERE minX>=-81.08 AND maxX<=-80.58
   ...>    AND minY>=35.00  AND maxY<=35.44;
****************Note that there's no output here!!!!  And there shouldn't
be....minY is 33.377 for ID#1
****************So let's put in some correct numbers
sqlite> delete from demo_index where id=1;
sqlite> INSERT INTO demo_index VALUES(
   ...>     1,                   -- Primary key
   ...>     -80.7749, -80.7747,  -- Longitude range
   ...>     35.3776, 35.3778     -- Latitude range
   ...> );
sqlite> SELECT id FROM demo_index
   ...>  WHERE minX>=-81.08 AND maxX<=-80.58
   ...>    AND minY>=35.00  AND maxY<=35.44;
1
sqlite> SELECT id FROM demo_index
   ...>  WHERE maxY>=35.0  AND minY<=35.0;
2

-----Original Message-----
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Richard Hipp
Sent: Wednesday, April 17, 2013 8:07 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] RTree Documentation Error?

On Wed, Apr 17, 2013 at 8:41 AM, Michael Black <mdblac...@yahoo.com> wrote:

> I think the point is that this query that produces nothing:
> SELECT id FROM demo_index WHERE minX>=-81.08 AND maxX<=-80.58 AND
> minY>=35.00  AND maxY<=35.44;
>
> Should produce something as the directions imply.
>

And my point is that the query DOES produce a result.  Are y'all saying you
are getting an empty result for the second query?  What version of SQLite
are you running?  What platform?

-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to