VERIFIED SOLUTION i
X

Obtaining the value of a data column for each Feature in MapXtreme

UPDATED: December 11, 2018


That the specific values of a feature can be obtained using subscripts.

For example, F[0] gets the first value of Feature F.

Additionally, there are several examples in the Developer Guide as well as Developer Reference Guide related to searching features and/or feature collections.

Below sample illustrates how to search for features using a screen drawn circle.

// find nearest city to center of map
private void menuItemSearchNearest_Click(object sender, System.EventArgs e)
{
try
{
Cursor.Current = Cursors.WaitCursor;
// to compare to SearchWithinScreenRadius, we are
// calculating the search distance the same way it does
System.Drawing.Rectangle rect=mapControl1.Bounds;
System.Drawing.Point pt = new System.Drawing.Point(rect.Left, rect.Top);
pt.X += rect.Width/2;
pt.Y += rect.Height/2;
DPoint dpt1 = new DPoint();
// convert center point to map coords (could use map.Center)
_map.DisplayTransform.FromDisplay(pt, out dpt1);
Distance d = MapInfo.Mapping.SearchInfoFactory.ScreenToMapDistance (_map,
3);
SearchInfo si =MapInfo.Data.SearchInfoFactory.SearchNearest(dpt1,
_map.GetDisplayCoordSys(), d);
IResultSetFeatureCollection fc = _catalog.Search("uscty_1k", si);
MapInfo.Geometry.Point p = new
MapInfo.Geometry.Point(_map.GetDisplayCoordSys(), dpt1);
FeatureGeometry buffer = p.Buffer(d.Value, d.Unit, 20,
DistanceType.Spherical);
ShowSearchGeometry(buffer);
SelectFeatureCollection(fc);
}
finally
{
Cursor.Current = Cursors.Default;
}
}

 

Environment Details

Product affected: MapXtreme .NET.
Product Feature: Features

Operating System: Windows 7 64bit

 

Downloads

  • No Downloads