From b3ce6fdeec5679fc40d4594d3ee8e4429fa29e2b Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Fri, 21 May 2010 19:51:30 +0100 Subject: [PATCH] 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. --- app/controllers/changeset_controller.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 -- 2.43.2