spaccabit / spatialite-android

Automatically exported from code.google.com/p/spatialite-android
0 stars 0 forks source link

Create VirtualSpatialIndex tests #24

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Create unit tests that make use of VirtualSpatialIndex and remove old rtree 
tests.

Original issue reported on code.google.com by efroh...@gmail.com on 14 Jan 2013 at 2:08

GoogleCodeExporter commented 8 years ago
Is VirtualSpatialIndex working on spatialite-android?

Original comment by mithenks...@gmail.com on 15 Apr 2013 at 1:06

GoogleCodeExporter commented 8 years ago
They should.  You could create a test to try it out?

Original comment by efroh...@gmail.com on 15 Apr 2013 at 1:26

GoogleCodeExporter commented 8 years ago
String query = "SELECT count(*) FROM regions WHERE pk_uid IN (SELECT rowid FROM 
SpatialIndex WHERE \"f_table_name\"='regions' AND 
\"f_geometry_column\"='Geometry' AND \"search_frame\" = 
GeomFromEWKT(\"SRID=4326;POLYGON((12.02 41.52,19.38 42.70,19.38 35.70,11.30 
36.06,12.02 41.52))\"))";

This is a test query I'm trying to execute with stmt.prepare().
It works with spatialiate_gui, gime me 11 regions, while is not on android.
No errors given, but 0 result.

Tell me if you want the complete workspace code.

Original comment by mithenks...@gmail.com on 16 Apr 2013 at 10:47

GoogleCodeExporter commented 8 years ago
Executing "Select count(*) from idx_regions_Geometry", I give "No such module: 
rtree".
I've followed the instructions on the main page to build spatialite-android, 
and then imported it in eclipse. 
Am I making a mistake somewhere?

Original comment by mithenks...@gmail.com on 16 Apr 2013 at 11:08

GoogleCodeExporter commented 8 years ago
Hard to tell what is going on from just the query.  If you are using the test 
DB there are no spatial indexes.  You will have to create them first.  If you 
can post more code and the database that would help.

Original comment by efroh...@gmail.com on 16 Apr 2013 at 12:20

GoogleCodeExporter commented 8 years ago
You can find a test code here: https://github.com/Mithenks/SpatialiteAndroidTest

Original comment by mithenks...@gmail.com on 16 Apr 2013 at 2:39

GoogleCodeExporter commented 8 years ago
I don't see where you are creating the spatial index.  Try adding something 
like:
select checkspatialindex()
select createspatialindex('HighWays','Geometry')
select checkspatialindex()

Original comment by efroh...@gmail.com on 17 Apr 2013 at 11:46

GoogleCodeExporter commented 8 years ago
The index is preexisting on the database.

However, I've added the queries you suggest.
The result is in the attached screenshot.

Original comment by mithenks...@gmail.com on 17 Apr 2013 at 1:29

Attachments:

GoogleCodeExporter commented 8 years ago
See revision: 3d9de54d66c7 
(https://code.google.com/p/spatialite-android/source/detail?r=3d9de54d66c74d5fab
aa183d8ed0822c010c8440)

Note that CheckSpatialIndex sometime returns the incorrect value. See: 
https://www.gaia-gis.it/fossil/libspatialite/tktview?name=1c3f376d50

Original comment by efroh...@gmail.com on 29 Apr 2013 at 1:35