GeoRSS aggregator and Layar augmented reality server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

29 lines
765 B

  1. class PostsController < ApplicationController
  2. include PostsHelper
  3. def near
  4. @posts = Post.near(params[:lat].to_f, params[:lon].to_f, params[:radius].to_f, params[:layer_id])
  5. # ErrorLog.create(
  6. # :ts => Time.now,
  7. # :params => params,
  8. # :pois_returned => @posts.size
  9. # )
  10. @layer = Layer.find(params[:layer_id])
  11. layar_response = {
  12. :layer => @layer.layar_name,
  13. :hotspots => @posts.collect { |p| post_to_poi(p) },
  14. :errorCode => 0, # OK
  15. :errorString => "OK",
  16. :radius => params[:radius].to_f
  17. }
  18. respond_to do |format|
  19. format.html # near.html.erb
  20. format.json { render json: @posts }
  21. format.layar { render json: layar_response }
  22. end
  23. end
  24. end