Ila*_*sda 2 maps jquery google-maps
任何想法如何init定位(所以引脚被丢弃)GeoComplete?
$("#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"]
});
Run Code Online (Sandbox Code Playgroud)
上面的示例确实使地图居中,但它不会丢弃一个引脚.为什么?这里
在线演示.
在初始化时指定经度和纬度时,似乎没有放置引脚.
另一种方法是从初始化中删除位置选项,并在创建地理完整实例后立即执行一次性搜索默认位置:
// 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("");
});
Run Code Online (Sandbox Code Playgroud)
其次是按地址查找:
$("#geocomplete").geocomplete("find", "Pozna?, Poland");
Run Code Online (Sandbox Code Playgroud)
或者经度和纬度:
var lat_and_long = "52.4078567, 16.9271833";
$("#geocomplete").geocomplete("find", lat_and_long);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8036 次 |
| 最近记录: |