有没有一种方法可以使用 visua lstudio 代码和 google maps api 而不是使用 lat 和 lng 坐标导航到特定地址?

问题描述 投票:0回答:0
function initMap() {
    // The location of Uluru
    const uluru = { lat: -25.344, lng: 131.031 };
    // The map, centered at Uluru
    const map = new google.maps.Map(document.getElementById("map"), {
      zoom: 4,
      center: uluru,
    });
    // The marker, positioned at Uluru
    const marker = new google.maps.Marker({
      position: uluru,
      map: map,
    });
  }
  
  window.initMap = initMap;

这工作正常,而是找到并输入纬度和经度:

纬度:-25.344,经纬度:131.031

有没有办法在代码中制作一些东西,例如:

“新建你的城市......一些街道地址”,它会导航到它? 我知道你可以用一个按钮来找到位置但是如何在代码中做一些静态的东西你放一个字符串它会找到它?

javascript google-maps visual-studio-code
© www.soinside.com 2019 - 2024. All rights reserved.