Angular 지리 기호 지도
Angular 지도 구성 요소에서는 IgxGeographicSymbolSeriesComponent
사용하여 지리적 맥락에서 점이나 마커를 사용하여 지리 공간 데이터를 표시할 수 있습니다. 이러한 유형의 지리 시리즈는 도시, 공항, 지진 또는 관심 장소와 같은 지리적 위치 모음을 렌더링하는 데 자주 사용됩니다.
Angular Geographic Symbol Map Example
Data Requirements
지도 구성 요소의 다른 유형의 지리적 계열과 마찬가지로 IgxGeographicSymbolSeriesComponent
에는 객체 배열에 바인딩될 수 있는 ItemsSource
속성이 있습니다. 또한 이 개체의 각 데이터 항목에는 지리적 위치(경도 및 위도)를 저장하는 두 개의 숫자 데이터 열이 있어야 합니다. 그런 다음 이러한 데이터 열은 latitudeMemberPath
및 longitudeMemberPath
속성에 매핑됩니다. IgxGeographicSymbolSeriesComponent
는 이러한 매핑된 데이터 열의 값을 사용하여 지리 지도 구성 요소의 기호 요소를 그립니다.
Code Snippet
다음 코드는 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 References
IgxGeographicSymbolSeriesComponent
ItemsSource
latitudeMemberPath
longitudeMemberPath
IgxShapeDataSource
에서 페이지 보기
GitHub