typescript 如何在有角度的谷歌地图中最初缩放地图
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/49420047/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to initially zoom a map in angular google maps
提问by Aizen
I am using agm/core
in displaying the coordinates of a map. I have the code below
我agm/core
用于显示地图的坐标。我有下面的代码
<agm-map [latitude]="10.3207886" [longitude]="123.90250049999997">
<agm-marker [latitude]="10.3207886 [longitude]="123.90250049999997"></agm-marker>
</agm-map>
The view is this:
观点是这样的:
But I want to initially show the streets like this:
但我想最初显示街道是这样的:
How to do that?
怎么做?
采纳答案by Esco
Set zoom and center attributes. For example.
设置缩放和中心属性。例如。
<agm-map zoom="8" [center]="10.3207886, 123.90250049999997">
<agm-marker [latitude]="10.3207886" [longitude]="123.90250049999997"></agm-marker>
</agm-map>
center is usually to specify which area you want to concentrate on, according to it change zoom level
center 通常是指定你要关注的区域,根据它改变缩放级别
回答by Aizen
The update for agm-map does not support center directives anymore. use zoom and latitude and long instead.
agm-map 的更新不再支持中心指令。使用缩放和纬度和长代替。
<agm-map [zoom]="13" [latitude]="127.1" [longitude]="141.1">
<agm-marker [latitude]="127.1" [longitude]="141.1"></agm-marker>
</agm-map>