]> git.openstreetmap.org Git - rails.git/commitdiff
Use BETWEEN for the node selection in the map API call as MySQL seems to
authorTom Hughes <tom@compton.nu>
Wed, 5 Sep 2007 17:20:09 +0000 (17:20 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 5 Sep 2007 17:20:09 +0000 (17:20 +0000)
process it more efficiently.

app/controllers/api_controller.rb

index 7e8017f4e3736dabf1471d6d1f6730f045506ad5..407f6872afe6ec11d6d1c375e8bff98ee1222ea3 100644 (file)
@@ -141,7 +141,7 @@ class ApiController < ApplicationController
     end
 
     # get all the nodes
-    nodes = Node.find(:all, :conditions => ['latitude > ? AND longitude > ? AND latitude < ? AND longitude < ? AND visible = 1', min_lat, min_lon, max_lat, max_lon])
+    nodes = Node.find(:all, :conditions => ['latitude BETWEEN ? AND ? AND longitude BETWEEN ? AND ? AND visible = 1', min_lat, max_lat, min_lon, max_lon])
 
     node_ids = nodes.collect {|node| node.id }