+ ##
+ # Generate a condition to choose which notes we want based
+ # on the user's bounding box request parameters
+ def bbox_condition(notes)
+ if params[:bbox]
+ bbox = BoundingBox.from_bbox_params(params)
+
+ bbox.check_boundaries
+ bbox.check_size(Settings.max_note_request_area)
+
+ @min_lon = bbox.min_lon
+ @min_lat = bbox.min_lat
+ @max_lon = bbox.max_lon
+ @max_lat = bbox.max_lat
+
+ notes.bbox(bbox)
+ else
+ notes
+ end
+ end
+
+ ##
+ # Get author's information (for logged in users - user_id, for logged out users - IP address)
+ def author_info
+ if current_user
+ { :user_id => current_user.id }
+ else
+ { :user_ip => request.remote_ip }
+ end
+ end
+