- new_params[:zoom] = zoom
- new_params[:controller] = 'site'
- new_params[:action] = 'index'
- redirect_to new_params
+
+ new_params[:anchor] = "map=#{zoom}/#{lat}/#{lon}"
+ new_params[:anchor] += "&layers=#{params[:layers]}" if params.key? :layers
+
+ options = new_params.to_unsafe_h.to_options
+
+ path = if params.key? :node
+ node_path(params[:node], options)
+ elsif params.key? :way
+ way_path(params[:way], options)
+ elsif params.key? :relation
+ relation_path(params[:relation], options)
+ elsif params.key? :changeset
+ changeset_path(params[:changeset], options)
+ else
+ root_url(options)
+ end
+
+ redirect_to path