javascript - 从文本地址框创建链接以自动转到 Google map 街景

标签 javascript google-maps

我想创建一个链接,将我带到“Google 街景”地址。我找到了这个: How to convert an address into a Google Maps Link (NOT MAP)

上述问题的解决方案是: http://maps.google.com/?q=1200宾夕法尼亚大道 SE,华盛顿哥伦比亚特区,20003

是否可以向链接添加参数以使其自动转到街景 View ?

我目前在应用程序中使用 arcgis World Geocoder,因此我将尝试将链接中输入的地址传递到 Google 街景 View 。

    function locate() {
      map.graphics.clear();
      var address = {
        "SingleLine": dom.byId("address").value
      };
      locator.outSpatialReference = map.spatialReference;
      var options = {
        address: address
      }
      locator.addressToLocations(options);
    }

谢谢!

最佳答案

可以做到

这是 Google 文档的示例

 var fenway = new google.maps.LatLng(42.345573,-71.098326);
var mapOptions = {
  center: fenway,
  zoom: 14
};
var map = new google.maps.Map(
    document.getElementById("map-canvas"), mapOptions);
var panoramaOptions = {
  position: fenway,
  pov: {
    heading: 34,
    pitch: 10
  }
};
var panorama = new  google.maps.StreetViewPanorama(document.getElementById("pano"), panoramaOptions);
map.setStreetView(panorama);

here is the result

关于javascript - 从文本地址框创建链接以自动转到 Google map 街景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24211680/

相关文章:

javascript - 在 React 的特定输入字段中输入文本后如何启用按钮?

javascript - 使十六进制颜色变亮或变暗

javascript - angular scope assign img src 会先发出错误的请求

javascript - 引用同一模板的多个 Angular Directive(指令)

swift - 如何在google maps sdk中使用函数外的变量

php - 将 google place api 照片保存到我的服务器

javascript - 如何在 jquery 中拖动可拖动时禁用页面滚动?

Android Google Maps API OnLocationChanged 仅调用一次

ios - Google Map iOS SDK - 清除可见区域内和不可见区域内的所有标记

javascript - 在谷歌地图中查找相对于当前用户位置最接近坐标的位置(在一组给定的坐标中)