我是RoR新手。
我被困在设置一个标志(图像)在谷歌地图上从数据库(纬度和经度)加载的点。
请帮忙!
您可以使用来自Google Maps的嵌入代码,并添加带有变量的lat/long。例如,假设您的纬度在变量@latitude
中,经度在变量@longitude
中:
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?q="+<%= @latitude %>+",+"+<%= @longitude >+"+(You+can+insert+your+text+here)&hl=en&ie=UTF8&t=m&z=14&iwloc=A&output=embed">
</iframe>
<br />
<small>
<a href="https://maps.google.com/maps?q="+<%= @latitude %>+",+"+<%= @longitude %>+"+(You+can+insert+your+text+here)&hl=en&ie=UTF8&t=m&z=14&iwloc=A&source=embed" style="color:#0000FF;text-align:left">
View Larger Map
</a>
</small>