Blazor Binding and Overlaying Multiple Shape Files
Ignite UI for Blazor 맵에서 여러 지리적 시리즈 객체를 추가하여 몇 개의 셰이프파일을 지리 공간 데이터로 오버레이할 수 있습니다. 예를 들어, 항구의 지리적 위치를 플로팅하는 IgbGeographicSymbolSeries
, 항구 간 경로를 플로팅하는 IgbGeographicPolylineSeries
, 국가의 모양을 플로팅하는 IgbGeographicShapeSeries
있습니다.
Blazor Binding and Overlaying Multiple Shape Files Example
Like this sample? Get access to our complete Ignite UI for Blazor toolkit and start building your own apps in minutes. Download it for free.
이 항목에서는 지도 구성 요소에 여러 지리적 계열을 표시하는 방법을 단계별로 안내합니다. 다음을 사용하여 모양 파일에서 로드된 지리 공간 데이터를 따르는 모든 지리 계열 플롯 IgbShapeDataSource
수업. 다음을 참조하세요. 모양 파일 바인딩 자세한 내용은 주제를 참조하세요. IgbShapeDataSource
물체.
IgbGeographicSymbolSeries
– 주요 도시의 위치를 표시합니다.IgbGeographicPolylineSeries
– 주요 포트 간의 경로를 표시합니다.IgbGeographicShapeSeries
– 세계 국가의 모양을 표시합니다.
위의 지리적 계열이나 다른 조합을 사용하여 원하는 데이터를 표시할 수 있습니다.
Importing Components
먼저 필수 구성 요소와 모듈을 가져옵니다.
// in Program.cs file
builder.Services.AddIgniteUIBlazor(
typeof(IgbGeographicMapModule),
typeof(IgbDataChartInteractivityModule)
);
razor
Creating Series
다음으로, 나중에 다른 유형의 쉐이프파일을 로드할 몇 가지 지리적 시리즈가 포함된 지도를 만들어야 합니다.
<IgbGeographicMap Height="100%" Width="100%" Zoomable="true">
<IgbGeographicShapeSeries ShapefileDataSource="@AsiaShape" Outline="Black" Thickness="1" Brush="Red" />
<IgbGeographicShapeSeries ShapefileDataSource="@EuropeShape" Outline="Black" Thickness="1" Brush="Purple" />
</IgbGeographicMap>
razor
Loading Shapefiles
다음으로 페이지 생성자에서 지리 지도 구성 요소에 표시하려는 각 모양 파일에 대해 IgbShapeDataSource
추가합니다.
public IgbShapeDataSource AsiaShape;
public IgbShapeDataSource EuropeShape;
protected override void OnInitialized()
{
this.AsiaShape = new IgbShapeDataSource()
{
ShapefileSource = "https://static.infragistics.com/xplatform/shapes/world_region_asia.shp",
DatabaseSource = "https://static.infragistics.com/xplatform/shapes/world_region_asia.dbf"
};
this.EuropeShape = new IgbShapeDataSource()
{
ShapefileSource = "https://static.infragistics.com/xplatform/shapes/world_region_europe.shp",
DatabaseSource = "https://static.infragistics.com/xplatform/shapes/world_region_europe.dbf"
};
}
razor
Map Background
또한 모양 파일이 애플리케이션에 충분한 지리적 컨텍스트(예: 국가 모양)를 제공한 경우 지도 배경 콘텐츠에서 지리적 이미지를 숨길 수도 있습니다.
<IgbGeographicMap Height="100%" Width="100%" BackgroundContent="@null"/>
razor
Summary
귀하의 편의를 위해 위의 모든 코드 조각은 아래의 하나의 코드 블록으로 결합되어 프로젝트에 쉽게 복사할 수 있습니다.
@using IgniteUI.Blazor.Controls
<IgbGeographicMap Height="100%" Width="100%" Zoomable="true">
<IgbGeographicShapeSeries ShapefileDataSource="AsiaShape" Outline="Black" Thickness="1" Brush="Red" />
<IgbGeographicShapeSeries ShapefileDataSource="EuropeShape" Outline="Black" Thickness="1" Brush="Purple" />
</IgbGeographicMap>
@code {
public IgbShapeDataSource AsiaShape;
public IgbShapeDataSource EuropeShape;
protected override void OnInitialized()
{
this.AsiaShape = new IgbShapeDataSource()
{
ShapefileSource = "https://static.infragistics.com/xplatform/shapes/world_region_asia.shp",
DatabaseSource = "https://static.infragistics.com/xplatform/shapes/world_region_asia.dbf"
};
this.EuropeShape = new IgbShapeDataSource()
{
ShapefileSource = "https://static.infragistics.com/xplatform/shapes/world_region_europe.shp",
DatabaseSource = "https://static.infragistics.com/xplatform/shapes/world_region_europe.dbf"
};
}
}
razor