简体   繁体   English

使用vue2-google-maps旋转谷歌地图

[英]Rotate google map with vue2-google-maps

I want to turn the map 90 degrees. 我想将地图旋转90度。 How can I do ? 我能怎么做 ? I use vue2-google-maps to create a map. 我使用vue2-google-maps创建地图。

        <GmapMap
          id="map"
          :center="{lat:latitude, lng:longitude}"
          map-type-id="satellite"
          style="width: 100vw; height: 100vh"
          :zoom= zoom
          :tilt="rotate" // 45
          :options="{
            rotateControl: true,
            minZoom:5,
            maxZoom:20,
          }"
      />

According to documentation : 根据文件

Once your map is displaying 45° imagery, you can orient the imagery towards one of its cardinal directions by calling setHeading() on the Map object, passing a number value expressed as degrees from North. 一旦地图显示45°图像,您可以通过调用Map对象上的setHeading()来传递图像,使其朝向其主要方向之一,并传递一个以北方度数表示的数字值。

So, orient the imagery ( heading property) could be specified once 45° imagery is set, here is an example for vue-google-maps 因此,一旦设置了45°图像,就可以指定图像的headingheading属性),这里是vue-google-maps的示例

<template>
  <div>
    <GmapMap 
       :center="center" 
      :zoom="zoom" 
      :mapTypeId="'satellite'"
      :tilt="titl"
      :heading="heading"
       ref="map">

    </GmapMap>
  </div>
</template>

<script>
export default {
  data() {
    return {
      zoom: 18,
      center: { lat: 45.518, lng: -122.672 },
      titl: 45,
      heading: 90
    };
  },
  methods: {}
};
</script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM