Angular 地理記号マップ

    Angular マップ コンポーネントでは、IgxGeographicSymbolSeriesComponent を使用して、地理的コンテキストでポイントまたはマーカーを使用して地理空間データを表示できます。地理的シリーズのこのタイプは、都市、空港、地震または興味のあるポイントなどの地理的位置のコレクションを描画するためにしばしば使用されます。

    Angular 地理記号マップの例

    データ要件

    マップコンポーネントの他の種類の地理的シリーズと同様に、IgxGeographicSymbolSeriesComponent には、オブジェクトの配列にバインドできる ItemsSource プロパティがあります。さらに、このオブジェクトの各データ項目は、地理的位置 (経度と緯度) を保存する 2 つの数値データ列を持つ必要があります。これらのデータ列は、latitudeMemberPath および longitudeMemberPath プロパティにマップされます。IgxGeographicSymbolSeriesComponent は、これらのマップされたデータ列の値を使用して、地理マップコンポーネントにシンボル要素をプロットします。

    コード スニペット

    以下のコードは、IgxShapeDataSource を使用してシェイプ ファイルからロードした都市の場所に IgxGeographicSymbolSeriesComponent をバインドする方法を示します。

    <div className="sampleRoot" >
        <igx-geographic-map #map
            width="700px"
            height="500px"
            zoomable="true" >
        </igx-geographic-map>
      </div>
    
    <ng-template let-series="series" let-item="item" #template>
            <div>
                <div *ngIf="item.org;then hasOrg; else notOrg" ></div>
                <span [style.color]="series.brush">
                    {{item.name}}
                </span>
                <br/>
                <span>
                    Population {{item.pop}} M
                </span>
            </div>
            <ng-template #hasOrg>
                <span>
                    Population {{item.pop}} M
                </span>
                <br />
            </ng-template>
             <ng-template #notOrg>
                <span>
                </span>
             </ng-template>
    </ng-template>
    
    import { AfterViewInit, Component, TemplateRef, ViewChild } from "@angular/core";
    import { MarkerType } from 'igniteui-angular-charts';
    import { IgxGeographicMapComponent } from 'igniteui-angular-maps';
    import { IgxGeographicSymbolSeriesComponent } from "igniteui-angular-maps";
    import { WorldLocations } from "../../utilities/WorldLocations";
    
    @Component({
      selector: "app-map-geographic-scatter-symbol-series",
      styleUrls: ["./map-geographic-scatter-symbol-series.component.scss"],
      templateUrl: "./map-geographic-scatter-symbol-series.component.html"
    })
    
    export class MapTypeScatterSymbolSeriesComponent implements AfterViewInit {
    
        @ViewChild ("map")
        public map: IgxGeographicMapComponent;
        @ViewChild("template")
        public tooltip: TemplateRef<object>;
    
        constructor() {
        }
    
        public ngAfterViewInit(): void {
          this.addSeriesWith(WorldLocations.getCities(), "Gray");
          this.addSeriesWith(WorldLocations.getCapitals(), "rgb(32, 146, 252)");
        }
    
        public addSeriesWith(locations: any[], brush: string) {
            const symbolSeries = new IgxGeographicSymbolSeriesComponent ();
            symbolSeries.dataSource = locations;
            symbolSeries.markerType = MarkerType.Circle;
            symbolSeries.latitudeMemberPath = "lat";
            symbolSeries.longitudeMemberPath = "lon";
            symbolSeries.markerBrush  = "White";
            symbolSeries.markerOutline = brush;
            symbolSeries.tooltipTemplate = this.tooltip;
            this.map.series.add(symbolSeries);
        }
    }
    

    API リファレンス