无法显示在Google地图API上绘制的圆圈

时间:2017-08-08 14:12:01

标签: angular google-maps-api-3 ionic-framework draw

我正在使用Angular / Ionic开展项目, 我在文档中搜索过,并开始使用预定义的

<iframe src="https://www.google.com/maps/embed/v1/undefined?origin=...&q=...&destination=...&center=...&zoom=...&key=..." allowfullscreen></iframe>

现在我有了地图,我想在这张地图上画圆圈,但我尝试了很多东西并且失败了。

这是我的代码:

location: any;
cityCircle: any;
map: any;
marker: any;

ngOnInit() {
    this.map = new google.maps.Map(document.getElementById('map'));
    this.location = "https://www.google.com/maps/embed/v1/place?q=" + this.navParams.get('Loca') + "&zoom=12&key=KEYCODE";
    console.log(this.navParams.get('Lat'), this.navParams.get('Long'), this.navParams.get('Radius'));
    var cityCircle = new google.maps.Circle({
        strokeColor: '#FF0000',
        strokeOpacity: 0.8,
        strokeWeight: 2,
        fillColor: '#FF0000',
        fillOpacity: 0.35,
        map: this.map,
        center: {
            lat: this.navParams.get('Lat'),
            lng: this.navParams.get('Long')
        },
        radius: this.navParams.get('Radius') * 10000
    });

0 个答案:

没有答案