From: Tom Hughes Date: Sun, 24 Jun 2007 10:51:29 +0000 (+0000) Subject: Allow all trackpoints to be fetched, not just those from public traces and X-Git-Tag: live~8421 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/a4647430aac69ee19d675cee86fa124b14019b00?hp=b3d6d4291e19e1368b48d13cf67880f7c59b5d24 Allow all trackpoints to be fetched, not just those from public traces and the user's own traces. Also restore the 0.3 API functionality that eliminate duplicate points. --- diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index 4b785f8bc..054a9ca62 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -73,7 +73,7 @@ class ApiController < ApplicationController min_lon = min_lon * 1000000 max_lon = max_lon * 1000000 # get all the points - points = Tracepoint.find(:all, :conditions => ['gps_points.latitude > ? AND gps_points.longitude > ? AND gps_points.latitude < ? AND gps_points.longitude < ? AND ( public = 1 OR gpx_files.user_id = ? ) AND visible = 1', min_lat.to_i, min_lon.to_i, max_lat.to_i, max_lon.to_i, @user.id ], :select => "gps_points.*", :joins => "INNER JOIN gpx_files ON gpx_files.id = gpx_id", :offset => offset, :limit => TRACEPOINTS_PER_PAGE, :order => "timestamp DESC" ) + points = Tracepoint.find(:all, :conditions => ['latitude BETWEEN ? AND ? AND longitude BETWEEN ? AND ?', min_lat.to_i, max_lat.to_i, min_lon.to_i, max_lon.to_i], :select => "SELECT DISTINCT *", :offset => offset, :limit => TRACEPOINTS_PER_PAGE, :order => "timestamp DESC" ) doc = XML::Document.new doc.encoding = 'UTF-8'