From: Tom Hughes Date: Wed, 5 Sep 2007 17:20:09 +0000 (+0000) Subject: Use BETWEEN for the node selection in the map API call as MySQL seems to X-Git-Tag: live~8131 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/a287d24f127d53de6a049efd798349dc409053ea Use BETWEEN for the node selection in the map API call as MySQL seems to process it more efficiently. --- diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index 7e8017f4e..407f6872a 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -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 }