是否知道如何使用init来确定位置(因此取消了引脚)
$("#geocomplete").geocomplete({
map: ".map_canvas",
location: [52.4078567, 16.92718339999999], // is it centring the map, no pin thought
markerOptions: {
draggable: true
},
details: "form",
types: ["geocode", "establishment"]
});上面的例子确实是地图的中心,但是它不是掉下了一个引脚。为什么?
在线演示这里。
发布于 2012-10-20 14:49:25
当您在初始化时指定经度和纬度时,引脚似乎不被放置。
另一种方法是从初始化中删除location选项,并在您创建地理完整实例之后对默认位置执行一次性搜索:
// Run this function once after the first search
$("#geocomplete").geocomplete(options)
.one("geocode:result", function(event, result){
// Set the zoom level you require for the default map
var map = $("#geocomplete").geocomplete("map");
map.setZoom(13);
// Optionally empty the geocomplete input field
$("#geocomplete").val("");
});然后按地址查找:
$("#geocomplete").geocomplete("find", "Poznań, Poland");或按经度和纬度:
var lat_and_long = "52.4078567, 16.9271833";
$("#geocomplete").geocomplete("find", lat_and_long);https://stackoverflow.com/questions/12984124
复制相似问题