Gmaps4rails:缩放(不缩放)gmap [英] Gmaps4rails: scaling (not zooming) a gmap

查看:145
本文介绍了Gmaps4rails:缩放(不缩放)gmap的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是gmaps4rails,我有一套动态生成的标记,大约14个,可以在全球范围内显示。我使用auto_adjust,但它看起来不错,但是,似乎我为地图选择的尺寸完全适合两个缩放级别。它要么显示太多的地图(例如,你看到亚洲的两侧),或者如果我放大一个级别,我没有看到一些标记。
我们选择的CSS宽度和高度是我们想要放在窗口中的。更小或更大(以匹配两个缩放级别)看起来不太好。
目标是一个更大的图像,但保持相同,固定,缩放。
有没有缩放地图的方法,就像你可以使用图像一样?



我使用rails 2.3.11并且必须复制js / css资产并修改/覆盖gmaps4rails视图。我不使用gmapable模块。

解决方案

我希望有人能证明我错了,但看起来你不能缩放除缩放之外的地图。最低缩放级别0显示为地球的宽度使用了最多256像素(在开始重叠之前)。然后,如果我缩小到1,它将它加倍到512,然后放大到2,再加倍到1024.

所以我的解决方案,能够看到整个地球,但没有重叠,要么选择一个512或1024像素宽的大小,并放大到适当的水平。


I am using gmaps4rails and I have a set of dynamic generated markers, about 14, that I display across the globe. I use auto_adjust and it looks good, however, it seems that the size that I have chosen for the map fits perfectly between two zoom levels. It either shows too much of the map (e.g. you see asia on both sides) or if I zoom in one level, I don't see some markers. The css width and height we have chosen is what we want to fit in the window. Smaller or larger (to match the two zooming levels) wouldn't look as good. The goal being, a larger image, but staying at the same, fixed, zoom. Is there a way to scale the map, like you can with images?

I am using rails 2.3.11 and had to copy in the js/css assets and modify/override the gmaps4rails view. I am not using the gmapable module.

解决方案

I hope that somebody can prove me wrong, but it appears that you can not scale a map other than with zoom. The lowest zoom level, 0, appears to use up 256 pixels for the width of the globe (before it begins to overlap). Then if I zoom it out to 1, it doubles it to 512, then zooming to 2, it doubles again to 1024.

So my solution, to be able to see the entire globe but not have it overlap, is to either pick a size that is 512 or 1024 pixels wide and zoom to the appropriate level.

这篇关于Gmaps4rails:缩放(不缩放)gmap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆