IgxGeographicMap のマップ上をホバーした際のマウスの位置は plotAreaMouseOver イベントにて取得することができます。
イベント引数から現在マウスカーソルのあるプロットエリア上の X および Y 位置を取得することができますので、IgxGeographicMapComponent の getGeographicPoint() メソッドを使用してこれらの値を緯度経度の値に変換します。
<igx-geographic-map #map ..... (plotAreaMouseOver)="onPlotAreaMouseOver($event)" > </igx-geographic-map>
@ViewChild("map", { static: true }) public map: IgxGeographicMapComponent; public geoPoints: any; ..... onPlotAreaMouseOver(event: {args: IgxPlotAreaMouseEventArgs, sender: any}) { var geographicPoint = this.map.getGeographicPoint( { x: event.args.plotAreaPosition.x, y: event.args.plotAreaPosition.y }); //geographicPoint.x = マウス地点の経度 //geographicPoint.y = マウス地点の緯度 this.geoPoints = { "lon": Math.floor(geographicPoint.x * 100000) /100000, "lat": Math.floor(geographicPoint.y * 100000) /100000 }; this.ref.markForCheck(); }
