For anyone else wondering, the above steps do work. Here's an example
(RC 2.4-5):
-- Length of 10km expressed in degrees at given location ~= 0.12
ST_Length(MakeLine((MakePoint(-79.3849,43.6529,4326)),
(Transform(ShiftCoords(Transform(MakePoint(-79.3849,43.6529,4326),
2163),10000,0),4326))))
Unfortunately I'm having trouble with the final step of including the
spatial index filter in my query (so close!). Here's my query:
SELECT osm_nodes.node_id
FROM osm_nodes
WHERE PtDistWithin(osm_nodes.Geometry,
MakePoint(-79.3849,43.6529,4326), 10000) == 1
AND osm_nodes.node_id IN
(
SELECT pkid
FROM idx_osm_nodes_Geometry
WHERE pkid MATCH RTreeDistWithin(MakePoint(-79.3849,43.6529,4326),
0.12)
)
I get an "SQL error: SQL logic error or missing database" message. I'm
following this example in the cookbook:
http://www.gaia-gis.it/spatialite-2.4.0-4/spatialite-cookbook/html/neighbours.html,
but I've modified it slightly for my database. Could anyone tell me
where my mistake is?
Regards,
-Preet