Angular Geographic High Density Map
In Angular map component, you can use the IgxGeographicHighDensityScatterSeriesComponent
to bind and show scatter data ranging from hundreds to millions of data points requiring exceedingly little loading time.
Angular Geographic High Density Map Example
The demo above shows the IgxGeographicHighDensityScatterSeriesComponent
series in the map component bound to hundreds or even thousands of data points representing Australia’s population density. The map plot area with more densely populated data points represented as coalescences of red pixels and loosely distributed data points by discrete blue pixels.
Because there are so many data points, the series displays the scatter data as tiny dots as opposed to full size markers, and displays areas with the most data using a higher color density representing a cluster of data points.
Data Requirements
Similar to other types of scatter series in the map control, the IgxGeographicHighDensityScatterSeriesComponent
series has the ItemsSource
property which can be bound to an array of objects. In addition, each data item in the items source must have two data columns that store geographic longitude and latitude coordinates and uses the longitudeMemberPath
and latitudeMemberPath
properties to map these data columns.
Data Binding
The following table summarizes the GeographicHighDensityScatterSeries series properties used for data binding.
Property | Type | Description |
---|---|---|
ItemsSource |
any | Gets or sets the items source |
longitudeMemberPath |
string | Uses the ItemsSource property to determine the location of the longitude values on the assigned items |
latitudeMemberPath |
string | Uses the ItemsSource property to determine the location of the latitude values on the assigned items |
Heat Color Scale
The Heat Color Scale, an optional feature, determines the color pattern within the series. The following table summarizes the properties used for determining the color scale.
Property | Type | Description |
---|---|---|
heatMinimum |
Double | Defines the double value representing the minimum end of the color scale |
heatMaximum |
Double | Defines the double value representing the maximum end of the color scale |
heatMinimumColor |
Color | Defines the point density color used at the bottom end of the color scale |
heatMaximumColor |
Color | Defines the point density color used at the top end of the color scale |
Code Example
The following code demonstrates how set the heatMinimumColor
and heatMaximumColor
properties of the IgxGeographicHighDensityScatterSeriesComponent
<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>
<span>
{{item.n}}
</span>
</div>
</ng-template>
import { AfterViewInit, Component, TemplateRef, ViewChild } from "@angular/core";
import { IgxShapeDataSource } from 'igniteui-angular-core';
import { IgxGeographicHighDensityScatterSeriesComponent } from 'igniteui-angular-maps';
import { IgxGeographicMapComponent } from 'igniteui-angular-maps';
import { WorldUtils } from "../../utilities/WorldUtils";
@Component({
selector: "app-map-geographic-scatter-density-series",
styleUrls: ["./map-geographic-scatter-density-series.component.scss"],
templateUrl: ".map-geographic-scatter-density-series.component.html"
})
export class MapTypeScatterDensitySeriesComponent implements AfterViewInit {
@ViewChild ("map")
public map: IgxGeographicMapComponent;
@ViewChild("template")
public tooltip: TemplateRef<object>;
public geoLocations;
constructor() {
}
public ngAfterViewInit(): void {
// fetching geographic locations from public JSON folder
fetch("assets/Data/AusPlaces.json")
.then((response) => response.json())
.then((data) => this.onDataLoaded(data, ""));
}
public onDataLoaded(sds: IgxShapeDataSource, e: any) {
this.geoLocations = sds;
// creating HD series with loaded data
const geoSeries = new IgxGeographicHighDensityScatterSeriesComponent();
geoSeries.dataSource = sds;
geoSeries.longitudeMemberPath = "x";
geoSeries.latitudeMemberPath = "y";
geoSeries.heatMaximumColor = "Red";
geoSeries.heatMinimumColor = "Black";
geoSeries.heatMinimum = 0;
geoSeries.heatMaximum = 5;
geoSeries.pointExtent = 1;
geoSeries.tooltipTemplate = this.tooltip;
geoSeries.mouseOverEnabled = true;
// adding HD series to the geographic amp
this.map.series.add(geoSeries);
// zooming to bound of all geographic locations
const geoBounds = WorldUtils.getBounds(this.geoLocations);
geoBounds.top = 0;
geoBounds.height = -50;
this.map.zoomToGeographic(geoBounds);
}
}
API References
IgxGeographicHighDensityScatterSeriesComponent
IgxGeographicHighDensityScatterSeriesComponent
heatMaximumColor
heatMinimumColor
ItemsSource
latitudeMemberPath
longitudeMemberPath