围绕纬度和经度角度图绘制圆圈

问题描述 投票:0回答:1

我已经使用角度映射包集成了带有角度的bing map,现在想要在给定的经度和纬度周围绘制圆圈。为实现这一点,我使用了以下npm包

npm install --save angular-maps

npm install --save bingmaps

npm install --save @ types / bingmaps

npm install --save [email protected]

npm install --save json-loader

代码:app.component.ts

import { Component, OnInit } from '@angular/core';
import { LocalStorageService } from 'src/app/service/local-storage.service';
import { LOCATION_INITIALIZED } from '@angular/common';
import { TranslateServiceService } from 'src/app/service/translate-service.service';

import {
  MapModule, MapAPILoader, MarkerTypeId, IMapOptions, IBox, IMarkerIconInfo, WindowRef, DocumentRef, MapServiceFactory,
  BingMapAPILoaderConfig, BingMapAPILoader,
  GoogleMapAPILoader, GoogleMapAPILoaderConfig
} from 'angular-maps';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
  title = 'rj';
  lat: string;
  long: string;
  constructor(
    private localStorageService: LocalStorageService,
    private translateServiceService: TranslateServiceService) {

  }
  ngOnInit(): void {
    this.lat = '18.5204';
    this.long = '73.8567';
    this.checkLanguagePerferences();
  }
  checkLanguagePerferences() {
    const language = this.localStorageService.getLanguage();
    if (language) {
      this.translateServiceService.selectLangulage(language);
    }
  }





  _markerTypeId = MarkerTypeId;
  _options: IMapOptions = {
    disableBirdseye: false,
    disableStreetside: false,
    navigationBarMode: 1,
    showBreadcrumb: true,
    // zoom: 10
  };

  _box: IBox = {
    maxLongitude: null,
    maxLatitude: null,
    minLatitude: 20,
    minLongitude: 64
  };
  // ****************************************************
  public _iconInfo: IMarkerIconInfo = {

    markerType: MarkerTypeId.RoundedImageMarker,
    url: 'https://cdn3.iconfinder.com/data/icons/flat-icons-web/40/Location-512.png',
    size: { width: 40, height: 40 },
    markerOffsetRatio: { x: 0.5, y: 0.5 }
  };

  _click() {
    console.log("hello world...");
  }
}

App.component.html

 <i class="fa"></i>
            <div style="height: 600px" class="col-sm-6 col-md-6 col-lg-6">
              <x-map #xmap [Options]="_options">
                <x-map-marker 
                  [Latitude]=lat 
                  [Longitude]=long
                  [Title]="'My Marker'"
                  [IconInfo]="_iconInfo">
                    <x-info-box
                      [DisableAutoPan]="true"
                      [Description]="'Hi, this is the content of the <strong>info window</strong>. It is your responsibility to implement functionality such as close, etc...'">
                        <x-info-box-action [Label]="'Click Me'" (ActionClicked)="_click()"></x-info-box-action>
                    </x-info-box>
                </x-map-marker>
              </x-map>
            </div>

问题陈述:无法在地图标记周围绘制圆圈

angular typescript dictionary
1个回答
2
投票

在写这篇文章的那一刻,官方的“角度图”npm site说没有直接画圆圈的支持。

在此conversation建议使用本机Microsoft.Maps.SpatialMath.getRegularPolygon创建多边形,然后将其解析为ILatLong数组,并将其传递给x-map-polygon标签上的[Paths]。

很抱歉没有提供该问题的直接解决方案。如果您已经使用其他解决方案,请告诉我们。

© www.soinside.com 2019 - 2024. All rights reserved.