Sum of Items within a Radius?

Anonymous
05-08-2005, 07:27 PM
Relatively new to mappoint - question is this:
IS there a way to count up the number of items within a selected radius? I am asking this to find a way to count sales within a radius or any item.

I know mappoint can sum the imported data through metro areas, but I didn't know if there was a way within mappoint, or a plugin or tool, that would allow me to do this.

thanks!

mc

Wilfried
05-09-2005, 04:47 PM
Hi,

Yes very easy to do. I just made this testcode to see if it works:

private void selectedareaToolStripMenuItem_Click(object sender, EventArgs e)
{
MapPoint.SelectedArea sa = MP.ActiveMap.SelectedArea;
Location[] loc = new Location[5];

loc[0] = MP.ActiveMap.XYToLocation(sa.Left, sa.Top);
loc[1] = MP.ActiveMap.XYToLocation(sa.Left + sa.Width, sa.Top);
loc[2] = MP.ActiveMap.XYToLocation(sa.Left + sa.Width, sa.Top + sa.Height);
loc[3] = MP.ActiveMap.XYToLocation(sa.Left, sa.Top + sa.Height);
loc[4] = loc[0];

MP.ActiveMap.Shapes.AddPolyline(loc);

int PPCount = 0;
foreach (MapPoint.DataSet ds in MP.ActiveMap.DataSets) {
MapPoint.Recordset rs = ds.QueryPolygon(loc);
rs.MoveFirst();
while (!rs.EOF) {
PPCount++;
rs.MoveNext();
}
}
Console.WriteLine("Record count " + Convert.ToString(PPCount));
}

 
Web mp2kmag.com
mapforums.com