Update Google map by latitude and longitude form

后端 未结 4 1686
小鲜肉
小鲜肉 2021-02-06 19:32

So I am building a HTML page, in which i need a Google Map and a simple form which consists of two fields latitude and longitude.




        
4条回答
  •  无人共我
    2021-02-06 20:01

    This is an elegant solution, moves the camera to the point.

    var myLatlng = new google.maps.LatLng(lat, lng);
    map.panTo(myLatlng);
    

    This jumps directly to the point.

    var myLatlng = new google.maps.LatLng(lat, lng);
    map.setCenter(myLatlng);
    

提交回复
热议问题