On Tue, Apr 16, 2013 at 1:15 PM, Mohit Sindhwani <m...@onghu.com> wrote:
> Hi, I was looking at the RTree documentation page with one of my > colleagues - > http://www.sqlite.org/rtree.**html<http://www.sqlite.org/rtree.html> > > We tried the example with the schema in 3.1, populated the data from 3.2 > and then queried it using the query of 3.3 - we got no results while the > documentation says that "the query would very quickly locate the id of 1 > even if the R*Tree contained millions of entries". > > Is the line "AND minY>=35.00 AND maxY<=35.44;" supposed to be "AND > minY>=33.00 AND maxY<=35.44;" (33 instead of 35.00)? > I copy/pasted the code and it all seems to work for me. My copy/paste follows: 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 ); INSERT INTO demo_index VALUES( 1, -- Primary key -80.7749, -80.7747, -- Longitude range 33.3776, 35.3778 -- Latitude range ); INSERT INTO demo_index VALUES( 2, -81.0, -79.6, 35.0, 36.2 ); .print --- one SELECT * FROM demo_index WHERE id=1; SELECT id FROM demo_index WHERE minX>=-81.08 AND maxX<=-80.58 AND minY>=35.00 AND maxY<=35.44; .print --- two SELECT id FROM demo_index WHERE maxX>=-81.08 AND minX<=-80.58 AND maxY>=35.00 AND minY<=35.44; .print --- three SELECT id FROM demo_index WHERE maxY>=35.0 AND minY<=35.0; -- D. Richard Hipp d...@sqlite.org _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users