问题描述
|
我对这个出色的gem gmaps4rails有问题。
是否可以在地图上打印一条多义线,该多义线的两点之间没有标记列表中没有的位置?
更清楚地说,我添加以下代码,该代码取自Rails创建的HTML页面:
<script type=\"text/javascript\" charset=\"utf-8\">
function gmaps4rails_init() {
var script = document.createElement(\"script\");
script.type = \"text/javascript\";
script.src = \"http://google-maps-utility-library-v3.googlecode.com/svn/tags/infoBox/1.1.5/src/infoBox.js\";
document.body.appendChild(script);
Gmaps4Rails.map_options.type = \'TERRAIN\';
Gmaps4Rails.map_options.auto_adjust = true;
Gmaps4Rails.initialize();
Gmaps4Rails.markers = [
{\"latitude\": \"41.97\",\"longitude\": \"12.67\",\"description\": \"DEPARTURE DESCRIPTION HERE\",\"title\": \"TITLE HERE\"},{\"latitude\": \"45.58\",\"longitude\": \"12.57\",\"description\": \"ARRIVE DESCRIPTION HERE\",\"title\": \"TITLE HERE\"}
];
Gmaps4Rails.create_markers();
Gmaps4Rails.polylines = [
[
{\"latitude\": \"41.97\",\"longitude\": \"12.67\"},{\"latitude\": \"42.78\",\"longitude\": \"12.6\"},\"longitude\": \"12.57\"}
]
];
Gmaps4Rails.polylines_conf.strokeColor = \'#444444\';
Gmaps4Rails.create_polylines();
if(typeof gmaps4rails_callback == \'function\') { gmaps4rails_callback(); }
}
window.onload = gmaps4rails_init;
</script>
在地图上,我只希望将起点(41.97,12.67)结束作为标记显示的终点(45.58,12.57)。
但是我也想创建一条从起点到终点的折线:该折线必须从另一个中间点经过(42.78,12.6)。
问题是在地图上显示的折线是错误的:线从第一个点到第三个桥,但没有穿过第二个。
因此,我的问题是:是否必须将折线的所有点都包括在内作为标记?
编辑:从此页面https://github.com/apneadiving/Google-Maps-for-Rails/wiki/display-Everything!显然,即使折线的点不在标记列表中,也可以显示折线。
那么,为什么我的折线显示不正确?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)