VERIFIED SOLUTION i
X

How to add a point on the map in MapXtreme

UPDATED: August 7, 2017


This code illustrates how to add a point to a map in MapXtreme.


MIConnection Connection =new MIConnection ();

Connection.Open() ;

MapInfo.Data.TableInfoNative ti = new TableInfoNative("newtable");

ti.TablePath="c:\\temp\\testuk.tab";
MapInfo.Data.Column col=new MapInfo.Data.Column ();
col=MapInfo.Data.ColumnFactory.CreateStringColumn("test",30);
ti.Columns.Add (col);
col=new MapInfo.Data.GeometryColumn("Obj",mapControl1.Map.GetDisplayCoordSys());
ti.Columns.Add(col);
col=new MapInfo.Data.Column();
col.DataType=MIDbType.Style;
col.Alias = "MI_Style";
ti.Columns.Add(col);
ti.WriteTabFile ();

MapInfo.Data.Table miTable = Connection.Catalog.CreateTable(ti);
mapControl1.Map.Load(new MapTableLoader(miTable));

MapInfo.Geometry.FeatureGeometry g = new MapInfo.Geometry.Point(mapControl1.Map.GetDisplayCoordSys (), -81.350833, 28.725556);

MapInfo.Styles.SimpleVectorPointStyle vs = new MapInfo.Styles.SimpleVectorPointStyle();
MapInfo.Styles.CompositeStyle cs = new MapInfo.Styles.CompositeStyle(null, null, null, vs);
Feature f = new Feature(g, cs);
MapInfo.Data.Key k = miTable.InsertFeature(f);


Downloads

  • No Downloads