如何在agm-map中添加自定义Google Maps样式XML [英] How to add custom google maps styling xml in agm-map

查看:60
本文介绍了如何在agm-map中添加自定义Google Maps样式XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正尝试在 https://mapstyle.withgoogle.com/,自定义Google地图样式.

I am trying to customize the google maps with the help of https://mapstyle.withgoogle.com/, custom google maps styling.

我正在使用Google角度地图( https://github.com/SebastianM/angular-google-maps )库中.

I am using angular google maps(https://github.com/SebastianM/angular-google-maps) library in my angular app.

我想包含XML,以便以自定义样式显示agm-map.但是我不知道如何在agm-map中做到这一点.

I want to include the XML so that the agm-map is displayed with custom styles. But I don't know how to do it in agm-map.

请帮助我.

推荐答案

初始化地图时,您必须提供样式指令:

You have to provide the style directive when you initialize your map :

<agm-map 
[latitude]="lat"
[longitude]="lng"
[styles]="styles"
[zoom]="zoom"
[disableDefaultUI]="false"
[zoomControl]="false"
(mapClick)="mapClicked($event)">

样式是您在 https://mapstyle.withgoogle.com/

这是我创建的一个简单示例:

Here is a quick example i created : https://stackblitz.com/edit/angular-google-maps-demo-mgxqnr?file=app/app.component.ts

这篇关于如何在agm-map中添加自定义Google Maps样式XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆