Rails - 渲染模板和 zip
我正在尝试在 Rails 中构建一个 KML 文件,我已经成功完成了,但现在我还想提供一个 KMZ 格式,它将呈现 index.kml 文件并将其压缩。这就是我被难住的地方。我已更新 MIME 类型如下。
Mime::Type.register_alias "application/vnd.google-earth.kml+xml", :kml
Mime::Type.register_alias "application/vnd.google-earth.kmz", :kmz
这是我的格式块
def index
@map_items = Items.all
respond_with(@map_items) do |format|
format.kml
format.kmz { NOT SURE WHAT IS BEST TO DO }
format.georss
end
end
任何帮助将不胜感激。谢谢!
I'm trying to build a KML file in Rails, which I have done successfully, but now I want to provide a KMZ format as well which would render the index.kml file and zip it. Here is where I get stumped. I have updated the MIME Types as follows.
Mime::Type.register_alias "application/vnd.google-earth.kml+xml", :kml
Mime::Type.register_alias "application/vnd.google-earth.kmz", :kmz
Here is my format block
def index
@map_items = Items.all
respond_with(@map_items) do |format|
format.kml
format.kmz { NOT SURE WHAT IS BEST TO DO }
format.georss
end
end
ANy help would be much appreciated. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了一种通过延迟工作来做到这一点的方法。每次更新或创建点时,我都会触发 MapOverlayJob。
I figured out a way to do this with Delayed Job. Every time the points are updated or created I fire off the MapOverlayJob.