We have the PARC table with 400,000 land parcels and the PIPE table with 20,000 pipes.You will find below a simple query that finds all the parcels intersecting with the pipes buffer of 10 meters.For the one-pipe buffer (id = 155) and search_frame = pi.geometry the query result is correct.With search_frame = pa.geometry the result is INcorrect.Unfortunately, there is no chance of finding results for ALL pipes.Please suggest on how to reconstruct the query (Spatialite_gui 1.6.0).
SELECT pa.parc_id, pa.geometryFROM PIPE AS pi, PARC AS paWHERE pi.id = '155'and ST_Intersects(buffer(pi.geometry, 10), pa.geometry)AND pi.ROWID IN(SELECT ROWID FROM SpatialIndexWHERE f_table_name = 'pipe'AND search_frame = pi.geometry)group by pa.pk_uid
Mark, thanks for a quick respond!If I reorder my query, as you proposed, it returns an empty ResultSet!I am worried about running the query through all the 20,000 pipes from the PIPE table.Any idea?SELECT pa.parc_id, pa.geometryFROM PIPE AS pi, PARC AS paWHERE pi.id = '155'AND pa.ROWID IN(SELECT ROWID FROM SpatialIndexWHEREf_table_name = 'park' AND
I was able to figure out what was wrong.Again created PARC and PIPE tables and ran AddGeometryColumn and CreateSpatialIndex command.Now results seems to be correct.The query now investigates the reduced data set (90,000 parcels and 7,000 pipes) and it takes 35 seconds to find out25.000 parcels within 10 meters buffer. And 5 minutes to find 44,000 parcels within 100 meters buffer.How long will it take for about 400,000 land parcels (POLYGON) and 20,000 pipes (LINESTRING) with 100 meters buffer?Is there any kind of approch to reduce the computing time?My query looks like this now:SELECT pa.id, pa.geometry FROM PIPE AS pi, PARC AS paWHERE pa.ROWID IN(SELECT ROWID FROM SpatialIndexWHEREf_table_name = 'parc' ANDsearch_frame = ST_Buffer(pi.geometry, 10)
Unfortunately, there is no chance of finding results for ALL pipes.I