From: Tom Hughes Date: Fri, 21 May 2010 18:51:30 +0000 (+0100) Subject: Convert lat and lon values to integers X-Git-Tag: live~6886^2~8 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/b3ce6fdeec5679fc40d4594d3ee8e4429fa29e2b Convert lat and lon values to integers Make sure the lat and lon values in changeset bounding box queries are integers or Postgres will refuse to use the index. --- diff --git a/app/controllers/changeset_controller.rb b/app/controllers/changeset_controller.rb index d0a357c85..e17d652ad 100644 --- a/app/controllers/changeset_controller.rb +++ b/app/controllers/changeset_controller.rb @@ -345,7 +345,10 @@ private raise OSM::APIBadUserInput.new("Minimum longitude should be less than maximum.") unless bbox[0] <= bbox[2] raise OSM::APIBadUserInput.new("Minimum latitude should be less than maximum.") unless bbox[1] <= bbox[3] return ['min_lon < ? and max_lon > ? and min_lat < ? and max_lat > ?', - bbox[2] * GeoRecord::SCALE, bbox[0] * GeoRecord::SCALE, bbox[3]* GeoRecord::SCALE, bbox[1] * GeoRecord::SCALE] + (bbox[2] * GeoRecord::SCALE).to_i, + (bbox[0] * GeoRecord::SCALE).to_i, + (bbox[3] * GeoRecord::SCALE).to_i, + (bbox[1] * GeoRecord::SCALE).to_i] else return nil end