Open Street Maps에서 이미지 표시 Angular
Angular IgxOpenStreetMapImagery
는 전 세계의 OpenStreetMap© 기여자들이 공동으로 만든 무료 지리적 이미지 매핑 서비스입니다. 구성 옵션 없이 도로 지도 스타일로만 세계의 지리적 이미지 타일을 제공합니다. 이 지리적 이미지 서비스는 www.OpenStreetMap.org 웹 사이트에서 직접 액세스할 수 있습니다. 기본적으로 Ignite UI for Angular 맵 구성 요소는 이미 Open Street Maps의 지리적 이미지를 표시합니다. 따라서 Open Street Maps의 지리적 이미지를 표시하도록 컨트롤을 구성할 필요가 없습니다.
Angular Displaying Imagery from Open Street Maps Example
import { NgModule } from "@angular/core";
import { FormsModule } from "@angular/forms";
import { CommonModule } from "@angular/common";
import { BrowserModule } from "@angular/platform-browser";
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { AppComponent } from "./app.component";
import { IgxGeographicMapModule } from "igniteui-angular-maps";
import { IgxDataChartInteractivityModule } from "igniteui-angular-charts";
@NgModule({
bootstrap: [AppComponent],
declarations: [
AppComponent
],
imports: [
BrowserModule,
BrowserAnimationsModule,
CommonModule,
FormsModule,
IgxGeographicMapModule,
IgxDataChartInteractivityModule
],
providers: [],
schemas: []
})
export class AppModule {}
ts
import { AfterViewInit, Component, ViewChild } from "@angular/core";
import { IgxGeographicMapComponent } from "igniteui-angular-maps";
import { IgxOpenStreetMapImagery } from "igniteui-angular-maps";
@Component({
standalone: false,
selector: "app-root",
styleUrls: ["./app.component.scss"],
templateUrl: "./app.component.html"
})
export class AppComponent implements AfterViewInit {
@ViewChild("map", { static: true })
public map: IgxGeographicMapComponent;
constructor() {
}
public ngAfterViewInit(): void {
const tileSource = new IgxOpenStreetMapImagery();
this.map.backgroundContent = tileSource;
this.map.updateZoomWindow({ left: 0.2, top: 0.1, width: 0.7, height: 0.7});
}
}
ts
<div class="container vertical">
<igx-geographic-map #map
width="100%"
height="100%"
zoomable="true" >
</igx-geographic-map>
</div>
html
Like this sample? Get access to our complete Ignite UI for Angular toolkit and start building your own apps in minutes. Download it for free.
Code Snippet
이 코드 예제에서는 지도 구성 요소의 BackgroundContent
OpenStreetMap© 기여자의 지리 이미지를 제공하는 IgxOpenStreetMapImagery
객체로 명시적으로 설정합니다.
<igx-geographic-map #map
width="100%"
height="100%"
zoomable="true" >
</igx-geographic-map>
html
import { IgxGeographicMapComponent } from 'igniteui-angular-maps';
import { IgxOpenStreetMapImagery } from 'igniteui-angular-maps';
public map: IgxGeographicMapComponent;
const tileSource = new IgxOpenStreetMapImagery();
this.map.backgroundContent = tileSource;
ts
API References