Angular Geographic Polygon Map

    In Angular map component, you can use the IgxGeographicShapeSeriesComponent to display geo-spatial data using shape polygons in a geographic context. This type of geographic series is often used to render shapes of countries or regions defined by geographic locations.

    Angular Geographic Polygon Map Example

    The IgxGeographicShapeSeriesComponent works a lot like the IgxGeographicPolylineSeriesComponent except that geo-spatial data is rendered with polygons instead of polylines.

    Data Requirements

    Similar to other types of geographic series in the map control, the IgxGeographicShapeSeriesComponent has the ItemsSource property which can be bound to an array of objects. In addition, each data item in this object must have one data column that stores single/multiple shapes using an array of arrays of objects with x and y values representing geographic locations. This data column is then mapped to the shapeMemberPath property. The IgxGeographicShapeSeriesComponent uses points of this mapped data column to plot polygons in the map control.

    Code Snippet

    The following code demonstrates how to bind the IgxGeographicShapeSeriesComponent to shapes of countries in the world loaded from a shape file using the IgxShapeDataSource.

    <div className="sampleRoot" >
        <igx-geographic-map #map
            zoomable="true" >
    <ng-template let-series="series" let-item="item" #template>
            <div *ngIf=";then hasOrg; else notOrg" ></div>
            <span [style.color]="series.brush">
                Population {{item.pop}} M
        <ng-template #hasOrg>
                Population {{item.pop}} M
            <br />
            <ng-template #notOrg>
    import { AfterViewInit, Component, TemplateRef, ViewChild } from "@angular/core";
    import { IgxShapeDataSource } from 'igniteui-angular-core';
    import { IgxGeographicMapComponent } from 'igniteui-angular-maps';
    import { IgxGeographicShapeSeriesComponent } from 'igniteui-angular-maps';
      selector: "app-map-geographic-shape-polygon-series",
      styleUrls: ["./map-geographic-shape-polygon-series.component.scss"],
      templateUrl: "./map-geographic-shape-polygon-series.component.html"
    export class MapTypeShapePolygonSeriesComponent implements AfterViewInit {
        @ViewChild ("map")
        public map: IgxGeographicMapComponent;
        public tooltip: TemplateRef<object>;
        public data: any;
        constructor() {
        public ngAfterViewInit(): void {
          const sds = new IgxShapeDataSource();
          sds.shapefileSource = "assets/Shapes/WorldCountries.shp";
          sds.databaseSource  = "assets/Shapes/WorldCountries.dbf";
          sds.importCompleted.subscribe(() => this.onDataLoaded(sds, ""));
        public onDataLoaded(sds: IgxShapeDataSource, e: any) {
            const shapeRecords = sds.getPointData();
            console.log("loaded /Shapes/WorldCountries.shp " + shapeRecords.length);
            const countriesNATO: any[] = [];
            const countriesSCO: any[] = [];
            const countriesARAB: any[] = [];
            const countriesOther: any[] = [];
            for (const record of shapeRecords) {
                // using field/column names from .DBF file
                const country = {
                    name: record.fieldValues.NAME,
                    org: record.fieldValues.ALLIANCE,
                    points: record.points,
                    pop: record.fieldValues.POPULATION
                const group = record.fieldValues.ALLIANCE;
                if (group === "NATO") {
                } else if (group === "SCO") {
                } else if (group === "ARAB LEAGUE") {
                } else {
            this.addSeriesWith(countriesNATO, "rgb(32, 146, 252)", "NATO");
            this.addSeriesWith(countriesSCO, "rgb(252, 32, 32)", "SCO");
            this.addSeriesWith(countriesARAB, "rgb(14, 194, 14)", "AL");
            this.addSeriesWith(countriesOther, "rgb(146, 146, 146)", "Other");
        public addSeriesWith(shapeData: any[], shapeBrush: string, shapeTitle: string) {
            const seriesName = shapeTitle + "series";
            const geoSeries = new IgxGeographicShapeSeriesComponent();
            geoSeries.dataSource = shapeData;
            geoSeries.shapeMemberPath = "points";
            geoSeries.brush = shapeBrush;
            geoSeries.outline = "Black";
            geoSeries.tooltipTemplate = this.tooltip;
            geoSeries.thickness = 1;
            geoSeries.title = shapeTitle;

    API References