Select to view content in your preferred language

HeatMapLayer based on points from FeatureLayer

2318
4
07-14-2011 07:45 AM
AaronWeier
Regular Contributor
Hi All -

I'm trying to create a HeatMapLayer from points in a FeatureLayer.

How do i get the geometry from the FeatureLayer (e.g. 'MapPoints') so i can add them to the 'HeatMapPoints' point collection for the HeatMapLayer?

I have a query task set up on the FeatureLayer (which works) and i have 'returnGeometry' set to true. But I can't seem to figure out how to actually access that geometry information.

Thanks for any help you can offer!!
0 Kudos
4 Replies
JenniferNery
Esri Regular Contributor
Since you are using FeatureLayer, you need not run a QueryTask to get the geometry.

You can simply iterate through the graphics after UpdateCompleted.
var featureLayer = sender as FeatureLayer;
var heatLayer = MyMap.Layers["MyHeatMapLayer"] as HeatMapLayer;
foreach (var g in featureLayer.Graphics)
{
 var mp = Geometry.Clone(g.Geometry) as MapPoint;
 heatLayer .HeatMapPoints.Add(mp);
}
0 Kudos
AaronWeier
Regular Contributor
Fantastic!

Thank you Jennifer!!
0 Kudos
SureshMali
Emerging Contributor
Hi,
This one helped me too, additionally i am wondering if we could add heat map for one of the attribute of data points instead of its density over a subsidiary. For e.g. drawing heat map for revenue from customer instead of number of customer distributed over the subsidiary.
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Hi,
This one helped me too, additionally i am wondering if we could add heat map for one of the attribute of data points instead of its density over a subsidiary. For e.g. drawing heat map for revenue from customer instead of number of customer distributed over the subsidiary.

I don't think you can do that out of the box but you can tweak the HeatMapLayer code which is public.
0 Kudos