2012-10-20 3 views
2

init 위치가 (따라서 핀이 떨어 뜨림) GeoComplete으로 어떤 아이디어가 있습니까?jQuery 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"] 

}); 

예는 위의지도 중앙 않지만,이 핀 적하 아니다. 왜?
온라인 데모 here.

답변

5

초기화시 경도와 위도를 지정할 때 핀이 배치되지 않은 것처럼 보입니다. 주소에 의해 발견으로 이어

// 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 인스턴스를 생성 한 직후

대안은 초기화에서 위치 옵션을 제거하고 기본 위치의 일회성 검색을 수행하는 것입니다 :

var lat_and_long = "52.4078567, 16.9271833"; 
$("#geocomplete").geocomplete("find", lat_and_long); 
+0

마커 MISSI :

$("#geocomplete").geocomplete("find", "Poznań, Poland"); 

또는 위도와 경도로

알려진 이슈는 다음과 같습니다. https://github.com/ubilabs/geocomplete/issues/13 – mccannf

+0

위치 이름이 아닌 LAT 및 LON으로 찾을 수 있습니까? – Iladarsda

+1

@ 새 사용자 - 예. 편집 된 답변을 참조하십시오. – mccannf

관련 문제